2.1.2 No Keyboard Trap
Keyboard focus never gets stuck: you can always move on with Tab, or the page says how.
Level A
What the automated checks look for
Controls trap keyboard focus
Once focus reaches these controls, Tab and Shift+Tab only move it among them, and nothing on the page says how to get out.
Who it affects. People who use a keyboard or a switch are stuck: they can't reach the rest of the page without reloading it.
How to fix it. Let Tab move on past the last control. If the trap is on purpose (a modal dialog), close it with Escape and return focus to what opened it.
<dialog id="share">…<button type="button" onclick="share.close()">Close</button></dialog>
<!-- a dialog opened with showModal() closes on Escape -->Read more
- Understanding 2.1.2, from the W3C
- Previous: 2.1.1 Keyboard
- Next: 2.1.4 Character Key Shortcuts