{"data":{"slug":"github-thedaviddias-front-end-checklist-skills-autofocus-avoidance-b3f9b0d7a4ab","title":"Avoid Autofocus on Form Fields","summary":"Ensure screen reader users don't lose context by avoiding autofocus on form fields unless necessary. This includes removing autofocus attributes and using JavaScript to set focus after user interaction instead of on page load.","url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-autofocus-avoidance-b3f9b0d7a4ab","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-thedaviddias-front-end-checklist-skills-autofocus-avoidance-b3f9b0d7a4ab","markdown_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-autofocus-avoidance-b3f9b0d7a4ab.md","download_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-autofocus-avoidance-b3f9b0d7a4ab\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Verify that page load does not unexpectedly move focus away from the page top, especially on pages with content before the form. Use browser accessibility tooling or assistive tech to verify the fix.","instructions":"---\nname: autofocus-avoidance\ndescription: \"Use when reviewing rendered HTML, interactive components, or design-system patterns related to Avoid autofocus on form fields. Check native semantics first, then inspect keyboard behavior, focus flow, accessible names, and screen-reader output where relevant.\"\nmetadata:\n  category: accessibility\n  priority: low\n  difficulty: beginner\n  estimatedTime: \"10\"\n  source: frontendchecklist.io\n  url: https:\/\/frontendchecklist.io\/rules\/accessibility\/autofocus-avoidance\n---\n\n# Avoid autofocus on form fields\n\nAutofocus teleports screen reader users to mid-page without context\u2014they miss everything before the form and have no idea where they landed.\n\n## Quick Reference\n\n- Avoid autofocus on pages with content before the form\n- Autofocus disrupts screen reader users who lose page context\n- Use JavaScript focus after user interaction instead of page load\n- Login and search-only pages are exceptions where autofocus may be acceptable\n\n## Check\n\nSearch for autofocus attributes on form elements. Verify that page load does not unexpectedly move focus away from the page top, especially on pages with content before the form.\n\n## Fix\n\nRemove autofocus attributes from form elements. If focus management is needed, use JavaScript to set focus after user interaction rather than automatically on page load.\n\n## Explain\n\nExplain how autofocus moves screen reader users to mid-page without context, can trigger unexpected scrolling, and disrupts users who were reading content before the focused element.\n\n## Code Review\n\nReview the rendered markup and interactive states that affect Avoid autofocus on form fields. Flag exact elements, roles, labels, focus behavior, or keyboard interactions that violate the rule, and note how to verify the fix with browser accessibility tooling or assistive tech.\n\n---\n\nFor full implementation details, code examples, and framework-specific guidance,\nsee `references\/rule.md`.\n\nRule page: https:\/\/frontendchecklist.io\/rules\/accessibility\/autofocus-avoidance\n","use_cases":["Reviewing HTML for accessibility compliance","Testing interactive components for screen reader compatibility","Auditing design-system patterns for focus behavior"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/thedaviddias\/Front-End-Checklist\/blob\/e8d14d049010e2ce25afcd5e8609dfcbbe63e47e\/skills\/autofocus-avoidance\/SKILL.md","source_commit":"e8d14d049010e2ce25afcd5e8609dfcbbe63e47e","license":null,"version":null,"listing_approved_at":"2026-11-23","created_at":"2026-11-22T15:20:31.000000Z","updated_at":"2026-11-23T04:54:44.000000Z","seo_title":"Avoid autofocus on form fields for accessibility","seo_description":"Ensure screen reader users don't lose context by avoiding autofocus on form fields unless necessary.","seo_keywords":["accessibility checklist","autofocus on form fields","screen reader accessibility","focus management","HTML accessibility"]}}