{"data":{"slug":"github-thedaviddias-front-end-checklist-skills-focus-order-0dad2d2e342b","title":"Ensure Logical Focus Order for Accessibility","summary":"Verify that keyboard navigation follows the visual layout by aligning tab order with DOM structure, using semantic HTML and avoiding positive tabindex values.","url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-focus-order-0dad2d2e342b","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-thedaviddias-front-end-checklist-skills-focus-order-0dad2d2e342b","markdown_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-focus-order-0dad2d2e342b.md","download_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-focus-order-0dad2d2e342b\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Ensure HTML elements are ordered to match visual layout. Use tabindex='0' for custom interactive elements and tabindex='-1' for programmatic focus management. Validate focus flow in modals and dialogs to ensure focus trapping and proper return to triggering elements.","instructions":"---\nname: focus-order\ndescription: \"Use when reviewing rendered HTML, interactive components, or design-system patterns related to Ensure logical focus order. Check native semantics first, then inspect keyboard behavior, focus flow, accessible names, and screen-reader output where relevant.\"\nmetadata:\n  category: accessibility\n  priority: high\n  difficulty: intermediate\n  estimatedTime: \"20\"\n  source: frontendchecklist.io\n  url: https:\/\/frontendchecklist.io\/rules\/accessibility\/focus-order\n---\n\n# Ensure logical focus order\n\nWhen focus jumps unexpectedly, keyboard users get disoriented and can't find content\u2014mismatched visual and focus order makes navigation impossible.\n\n## Quick Reference\n\n- Tab order should match visual reading order (left-to-right, top-to-bottom)\n- DOM order determines tab order\u2014arrange HTML to match visual layout\n- Never use positive tabindex values (1, 2, 3)\u2014they break natural flow\n- Use CSS for visual positioning, not DOM reordering\n\n## Check\n\nTab through the page and verify focus moves in a logical sequence matching visual layout. Check that modals trap focus appropriately, and focus returns to triggering elements when dialogs close.\n\n## Fix\n\nOrder DOM elements to match visual layout. Avoid positive tabindex values which override natural order. Use tabindex='0' for custom interactive elements and tabindex='-1' for programmatic focus management.\n\n## Explain\n\nExplain how keyboard users rely on predictable tab order to navigate efficiently, and why mismatched visual and focus order creates confusion and reduces usability for assistive technology users.\n\n## Code Review\n\nReview the rendered markup and interactive states that affect Ensure logical focus order. 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\/focus-order\n","use_cases":["Reviewing focus order in HTML and interactive components","Auditing focus flow in modals and dialogs","Checking keyboard navigation for screen-reader compatibility"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/thedaviddias\/Front-End-Checklist\/blob\/e8d14d049010e2ce25afcd5e8609dfcbbe63e47e\/skills\/focus-order\/SKILL.md","source_commit":"e8d14d049010e2ce25afcd5e8609dfcbbe63e47e","license":null,"version":null,"listing_approved_at":"2026-11-23","created_at":"2026-11-22T16:12:39.000000Z","updated_at":"2026-11-23T04:55:09.000000Z","seo_title":"Ensure logical focus order for accessibility","seo_description":"Verify that keyboard navigation follows the visual layout by aligning tab order with DOM structure, using semantic HTML and avoiding positive tabindex values.","seo_keywords":["focus order accessibility","keyboard navigation audit","tab order validation","accessible focus flow","HTML focus order check"]}}