Keyboard focus must not be trapped
Rule
keyboard-trap· Component patterns (best practice) · impact critical · Live only (static → incomplete)
Why it matters
If pressing Tab stops moving focus — because a component swallows the key, or a modal contains focus with no escape — keyboard and screen-reader users are stranded. The engine Tabs through the live page and reports where focus stopped advancing.
How to fix
Ensure every component lets focus move out with Tab/Shift+Tab. For modals, trap focus only while open and restore it on close (and support Escape).
Example
<input onkeydown="if(event.key==='Tab')event.preventDefault()">
<input>
WCAG success criteria
2.1.2 No Keyboard Trap — Level A
Keyboard focus must never get stuck: a user who tabs into a component must be able to tab (or use a documented key) back out of it.
Standards
This rule contributes to the following standards:
WCAG A EN 301 549 Best practice
| Standard | Criteria |
|---|---|
| EN 301 549 | 9.2.1.2 |