← Back to Insights
Keyboard navigation and focus order

Keyboard Accessibility and Focus Order Under WCAG 2.2: A Practical Guide for Front-End and QA Teams

Generated image

Unplug your mouse. Open your product. Press Tab.

If you can't complete a core user journey - log in, search, submit a form, close a modal - without touching the mouse, your product has a keyboard accessibility failure. That failure is not cosmetic. It blocks real users, and under the European Accessibility Act it is now a legal liability.

WebAIM's 2026 analysis of one million homepages found 95.9% contain detectable WCAG failures - reversing six consecutive years of gradual improvement. The same six failure categories have topped the list for seven straight years, and they account for the vast majority of detected errors. Keyboard and focus problems are not in that top-six list because automated scanners largely cannot see them - which is precisely why they persist undetected in production.

This guide covers what WCAG 2.2 actually requires for keyboard access, where modern JS component libraries routinely break it, and how to run a manual keyboard test your team can repeat every release.


Why keyboard access is the foundation, not a feature

Every major category of assistive technology depends on keyboard operability being correct before it can do its job.

  • Screen readers (JAWS, NVDA, VoiceOver, TalkBack) navigate using keyboard shortcuts and the DOM focus order. If an element is unreachable by keyboard, a screen reader user cannot reach it either. If focus jumps unpredictably, the screen reader announces content out of sequence.
  • Switch access devices send Tab, Enter, and Space keystrokes. A user operating a single switch has no fallback if a custom dropdown only responds to mouse events.
  • Voice control software (Dragon NaturallySpeaking, Voice Control on macOS/iOS) identifies interactive targets by their visible labels and their position in the accessibility tree. A <div> wired with a click handler but no keyboard role or label is invisible to voice control.

The practical implication: fixing keyboard access fixes a large slice of assistive-technology access simultaneously. Screen readers, switch devices, and voice control all build on keyboard operability as their shared foundation - a keyboard failure is therefore an assistive-technology failure across multiple user groups.


What WCAG 2.2 actually requires

WCAG 2.2 did not merely add cosmetic focus-indicator rules. It tightened the keyboard/focus cluster in ways that affect real implementation decisions.

The existing criteria (still in force)

Criterion Level What it requires
2.1.1 Keyboard A All functionality operable by keyboard, no specific timing required
2.1.2 No Keyboard Trap A If focus can move into a component, it must be able to move out using standard keys
2.4.3 Focus Order A Focus sequence must preserve meaning and operability
2.4.7 Focus Visible AA A visible focus indicator must exist

New in WCAG 2.2

WCAG 2.2 added two new keyboard/focus criteria at AA and AAA: 2.4.11 Focus Not Obscured (Minimum) at Level AA, and 2.4.13 Focus Appearance at Level AAA.

2.4.11 Focus Not Obscured (Minimum) - Level AA. When a component receives keyboard focus, it must not be entirely hidden by author-created content. Sticky headers, cookie banners, chat widgets, and fixed footers are the usual culprits. Partial obscuring is tolerated at AA; full obscuring is a failure. The fix is usually a single CSS rule: scroll-padding-top matching your sticky header height.

2.4.13 Focus Appearance - Level AAA. Where 2.4.7 only required some visible indicator, 2.4.13 mandates measurable minimums: the focus indicator must have a contrast ratio of at least 3:1 against adjacent colours, and must meet a minimum area threshold (at least 1 CSS pixel along the perimeter, or 4 CSS pixels along the shortest side of the component). While AAA is not mandatory under EN 301 549 v3.2.1, it is the direction of travel - EN 301 549 v4 is expected to incorporate WCAG 2.2 AA, which would make 2.4.11 a hard legal requirement.

star Important

2.4.11 is already legally required under EAA/EN 301 549 via WCAG 2.2 AA. If your sticky header completely covers a focused element, that is a Level AA failure — not a nice-to-have. Check every fixed or sticky element on every breakpoint.


Focus order vs. focus visibility: two different problems

Teams often conflate these. They are distinct failure modes with different causes and fixes.

Focus order (WCAG 2.4.3) is about sequence: does Tab move through interactive elements in an order that matches the visual and reading order? The DOM order drives the default tab sequence. When CSS layout diverges from DOM order - flexbox order, CSS Grid placement, absolute positioning - the visual order and the keyboard order can split apart. A user tabbing through a three-column card layout may find focus jumping column-to-column rather than left-to-right.

Focus visibility (2.4.7, 2.4.11, 2.4.13) is about perception: can the user see where focus currently is? The most common failure is outline: none or outline: 0 in a global CSS reset, applied without a :focus-visible replacement. The second most common is focus being present but hidden behind a sticky element.

The tabindex trap

Positive tabindex values (tabindex="1", "2", etc.) override the natural DOM tab order - the browser tabs through all positive-indexed elements first, in numeric order, before falling back to DOM order for everything else. Add tabindex="1" to one element and you have promoted it ahead of every link, button, and form field on the page. Add it to ten elements and you have manually re-numbered the tab order, which means every future DOM edit silently breaks the sequence.

The rule is simple: in normal application code, the only acceptable tabindex values are 0 (makes a non-native element focusable in DOM order) and -1 (removes an element from the tab sequence, for programmatic focus management). Never use positive integers.


Where JS component libraries break keyboard access

Modern component libraries ship with varying levels of keyboard support. The pattern is consistent: mouse-event handlers are wired up; keyboard equivalents are not, or are incomplete.

Custom dropdowns and select menus

A <div> with a click handler and a CSS-animated list is not a dropdown. It has no role, no aria-expanded state, and no keyboard interaction. The correct pattern requires role="combobox" or role="listbox", aria-expanded, and onKeyDown handlers for Enter/Space (open/select), Arrow keys (navigate options), and Escape (close and return focus to trigger).

Modal dialogs

Modal failures are among the most common and most severe keyboard barriers. The six failure patterns that make modals unusable for keyboard users are:

  • Focus stays on the trigger when the modal opens (user cannot interact with modal content)
  • Focus escapes to background content while the modal is open
  • No Escape key support to close the modal
  • Close button is unreachable by keyboard
  • Background content remains interactive (screen reader users navigate to obscured content)
  • Focus returns to <body> on close instead of the trigger element

The correct behaviour: on open, move focus to the first focusable element inside the modal (or the modal container itself if there are none); trap Tab and Shift+Tab within the modal while it is open; on close, return focus to the element that triggered it. The native HTML <dialog> element handles most of this automatically - use it where browser support allows.

Tab panels

The ARIA Authoring Practices Guide pattern for tab panels uses roving tabindex: only the active tab has tabindex="0", all others have tabindex="-1". Arrow keys move between tabs; Tab moves into the panel content. Many implementations wire Tab to move between tabs instead, which breaks the expected keyboard contract and creates an inconsistent experience.

Date pickers

Date pickers are among the hardest components to make keyboard-accessible. A calendar grid requires arrow-key navigation between days, Page Up/Down for month navigation, and Escape to close without selecting. Most third-party date picker libraries either trap focus inside the calendar without an Escape exit, or expose the calendar only to mouse users and fall back to a plain text input for keyboard users - which is acceptable only if the text input accepts the same range of values.

lightbulb Tip

Third-party components inherit their accessibility problems into your product. If you embed a library widget that has a keyboard trap, you own the WCAG 2.1.2 failure — even if you did not write the code. Evaluate keyboard operability before adopting any component library.


Keyboard traps: the most severe barrier

A keyboard trap occurs when focus can move into a component but cannot move out using standard keyboard controls (Tab, Shift+Tab, Escape, arrow keys). WCAG 2.1.2 No Keyboard Trap is a Level A criterion - the most severe tier - because a keyboard trap completely blocks keyboard users from accessing the rest of the page, leaving them no option but to close the browser.

Traps most commonly appear in:

  • Embedded iframes (video players, maps, payment widgets) that capture Tab without providing an exit
  • Custom date pickers that open a calendar grid and provide no Escape key handler
  • Rich text editors that intercept Tab for indentation without documenting an alternative exit key
  • Third-party chat widgets that open a conversation panel and trap focus inside

The fix is always the same: ensure every component that receives focus can release it via standard keys, or - if a non-standard key is required - document that key clearly and programmatically (not just in a help page).


Why automated tools cannot solve this for you

Published estimates of automated accessibility testing coverage range from roughly 30% to 57% of WCAG violations depending on the study and tool - and every serious source agrees the remainder requires a person actually using the site.

Automated scanners are excellent at detecting structural issues: missing alt text, insufficient colour contrast, form fields without labels, ARIA misuse. They are structurally unable to test:

  • Whether the focus order makes sense in context
  • Whether a keyboard trap exists (the scanner does not press Tab)
  • Whether focus is returned to the correct element after a modal closes
  • Whether a custom widget's arrow-key navigation works as expected
  • Whether a sticky header covers the focused element at a particular scroll position

This is not a criticism of the tools - it is a structural limitation. The DOM can be syntactically correct and semantically broken at the same time. Only a human pressing Tab can find that.


Manual keyboard testing: a repeatable script for every release

Run this test on every critical user journey before each release. No screen reader required - just a keyboard and a browser.

1
Disconnect the mouse (or disable pointer events)

Physically unplug the mouse, or use browser DevTools to simulate keyboard-only. This forces you to experience what keyboard users experience — not what you think they experience.

2
Tab through the entire page from top to bottom

Press Tab repeatedly. Every interactive element — links, buttons, form fields, custom controls — must receive a visible focus indicator. Note any elements that are skipped or that receive focus but show no indicator. Note any elements that receive focus but should not (visually hidden content, decorative elements).

3
Verify focus order matches visual order

As you Tab, confirm that focus moves left-to-right, top-to-bottom (or in whatever order the visual layout implies). Flag any jumps that break the reading sequence — these are likely DOM-order/CSS-layout mismatches or positive tabindex values.

4
Test Shift+Tab (reverse navigation)

Tab backwards through the page. The sequence should be the exact reverse of forward Tab. Any asymmetry indicates a focus management bug.

5
Activate every interactive element with Enter and Space

Links activate with Enter. Buttons activate with Enter and Space. Custom controls should follow the same conventions. If a control only responds to mouse click, it fails WCAG 2.1.1.

6
Test all composite widgets with arrow keys

Dropdown menus, tab panels, radio groups, sliders, and date pickers should use arrow keys for internal navigation. Tab should move out of the widget, not between items within it (with the exception of some patterns like toolbars).

7
Open and close every modal and overlay with Escape

Open each modal, drawer, and popover. Confirm: (1) focus moves into the modal on open; (2) Tab cycles within the modal only; (3) Escape closes the modal; (4) focus returns to the trigger element on close. Failure on any of these is a WCAG 2.1.1 or 2.1.2 violation.

8
Check focus visibility against sticky elements

Scroll partway down the page, then Tab through elements near the top of the viewport. Confirm that no focused element is completely hidden behind a sticky header, cookie banner, or chat widget. This is your 2.4.11 check.

9
Test third-party embeds

Tab into every iframe, video player, map, and payment widget. Confirm you can Tab back out without closing the browser. A component that traps focus is a WCAG 2.1.2 failure regardless of who wrote it.

10
Document every failure with criterion, location, and severity

Vague findings do not get fixed. Record: the WCAG success criterion failed, the exact element and page, the steps to reproduce, and the expected vs. actual behaviour. Attach a screenshot showing the focus state (or lack of it).


The interactive keyboard accessibility decision tool

Use this tool to quickly identify which WCAG keyboard criteria apply to a component you are building or testing, and what the minimum requirements are.


How this maps to EAA and EN 301 549

The European Accessibility Act has been enforceable since 28 June 2025. EN 301 549 v3.2.1 - the harmonised standard that creates a presumption of conformity with the EAA - incorporates WCAG 2.1 Level AA as the technical requirement for web and mobile interfaces. EN 301 549 v4, which is expected to incorporate WCAG 2.2 AA (including 2.4.11), is in late-stage drafting.

The practical position for teams building or maintaining products sold into the EU:

  • WCAG 2.1 AA is the current legal floor. This includes 2.1.1 Keyboard, 2.1.2 No Keyboard Trap, 2.4.3 Focus Order, and 2.4.7 Focus Visible.
  • WCAG 2.2 AA is the direction of travel. Implementing 2.4.11 now avoids a remediation sprint when EN 301 549 v4 is published.
  • Any new digital product or service launched in 2026 or later must be accessible from day one - there is no grace period for new launches.
  • Non-compliance can result in fines, market restrictions, and removal from the EU market. Fines vary by member state.

EN 301 549 v4, incorporating WCAG 2.2, is in late-stage drafting and expected to publish in 2026 - at which point 2.4.11 Focus Not Obscured (Minimum) becomes a hard legal requirement under the EAA.


Prioritised fix checklist

Work through these in order. Items at the top are Level A failures (most severe); items lower down are Level AA.

Critical - fix before next release

  • No keyboard traps - every component that receives focus can release it via Tab, Shift+Tab, or Escape (WCAG 2.1.2, Level A)
  • All functionality keyboard-operable - no feature requires a mouse; all click handlers have keyboard equivalents (WCAG 2.1.1, Level A)
  • Focus order matches reading order - DOM order aligns with visual layout; no positive tabindex values in production code (WCAG 2.4.3, Level A)

High - fix within current sprint

  • Visible focus indicator on every interactive element - outline: none removed from global resets without a :focus-visible replacement (WCAG 2.4.7, Level AA)
  • Modal focus management - focus moves in on open, trapped inside, returned to trigger on close; Escape closes (WCAG 2.1.1, 2.1.2)
  • Focus not obscured by sticky elements - scroll-padding-top set to match sticky header height; cookie banners and chat widgets cannot fully cover focused elements (WCAG 2.4.11, Level AA)

Medium - address before compliance deadline

  • Custom dropdowns - role, aria-expanded, Enter/Space/Arrow/Escape keyboard handlers implemented
  • Tab panels - roving tabindex pattern; arrow keys navigate tabs, Tab moves into panel content
  • Date pickers - arrow-key grid navigation, Escape to close without selecting, Page Up/Down for month navigation
  • Third-party embeds audited - keyboard operability verified for every iframe, video player, map, and payment widget
  • Focus indicator contrast - focus ring meets 3:1 contrast ratio against adjacent colours (WCAG 2.4.13, AAA - but required by EN 301 549 v4)

Keyboard accessibility is not a specialist concern sitting at the edge of your backlog. It is the infrastructure that assistive technology runs on. Get it wrong and you have not just failed a checklist - you have made your product unusable for a significant portion of your users, and exposed your organisation to enforcement action under a law that is already in effect.

The test is simple: unplug the mouse, press Tab, and see what happens.