WCAG 2.1.2 No Keyboard Trap
Success Criterion 2.1.2 requires that if keyboard focus can be moved to a component using a keyboard interface, focus can also be moved away from that component using only a keyboard - and if it requires more than simple arrow/tab keys to exit, the user must be told how. It's a Level A criterion under Guideline 2.1 (Keyboard Accessible), closely related to 2.1.1 Keyboard.
Why this is a separate criterion from Keyboard itself
A component could technically satisfy "operable by keyboard" (2.1.1) - a modal that opens via Tab - while still failing this criterion if there's no keyboard-accessible way to close it and return focus to the rest of the page. Being able to enter a component and being able to leave it are genuinely distinct requirements, which is exactly why WCAG separates them.
The classic example
A modal dialog or embedded widget (an old-style Flash object, some custom-built rich text editors, certain third-party embeds) that captures keyboard focus and never releases it - a keyboard user tabs in, and there's no Escape key handler, no accessible close button, and Tab just cycles endlessly within the trapped component with no way out. The user is stuck.
The narrow exception
If exiting genuinely requires more than standard arrow keys, Tab, or other standard exit methods, that's permitted only if the user is informed how - for example, a code-editor widget that intentionally captures Tab for indentation would need to tell the user "press Escape then Tab to move focus out" rather than silently trapping them with no guidance at all.
How to check for this
Reach and operate each component using its expected keyboard interactions, including arrow keys within composite widgets. Confirm that you can leave it using the keyboard: Tab may move to the next component, while a modal must first be dismissed using a keyboard-accessible action. If leaving requires a nonstandard method, check that instructions are provided. A component is not a keyboard trap merely because Tab does not visit each of its items.
Common questions
- What is WCAG 2.1.2?
- A Level A criterion: if you can move focus into a component with the keyboard, you must be able to move it out again with standard keys, never getting trapped.
- What is a common keyboard trap?
- A modal dialog or embedded widget (like a media player or third-party plugin) that captures Tab and won't let focus escape back to the page.
- How do I fix a keyboard trap?
- Provide a keyboard-accessible way to leave each component. A modal may keep Tab inside while open, but must allow keyboard dismissal and return focus appropriately. Explain any nonstandard exit method.
Check these issues on your own website
Start with a free one-page preview, with no account or payment required. For scheduled scans, issue history and team workflows, explore paid monitoring.