Keyboard trap
When keyboard focus gets stuck inside one part of a page and you can't move away from it using only the keyboard.
Also called no keyboard trap (WCAG 2.1.2)
Example
In a made-up news article, Tab moves into an embedded video player and then just cycles round its buttons, never reaching the rest of the page.
When to use it
Tab into and back out of every embedded player, map, widget and pop-up. If leaving needs an unusual key, tell people which one. WCAG makes this a Level A requirement, the most basic level.
Watch out
Keeping focus inside an open dialog on purpose is fine, as long as people can leave it with the keyboard, for example by pressing Escape.
The evidence 4 sourced claims
Every sentence on this card traces back to one of these claims, each linked to its source. How we research
WCAG SC 2.1.2 No Keyboard Trap (Level A): if focus can move into a component with the keyboard, it must be possible to move it away using only the keyboard; if that needs more than standard keys, the user is told how.
Keyboard traps often come from content rendered using plug-ins or embedded applications.
Restricting focus to part of the content is acceptable as long as the user knows how to 'untrap' focus and leave that component with the keyboard.
In W3C's modal dialog pattern, Tab wraps within the dialog and Escape closes it.