Skip to main content
사용 중인 브라우저가 오래되어 이 사이트가 제대로 표시되지 않습니다. Chrome, Edge, Firefox 또는 Safari 최신 버전으로 업데이트해 주세요.
Back to WCAG Database
Level AWCAG 2.0

2.1.2 No Keyboard Trap

If keyboard focus can be moved to a component using a keyboard interface, focus can be moved away from that component using only a keyboard interface, and if more than unmodified arrow or tab keys are required, the user is advised of the method.

Last reviewed: September 9, 2026

Understanding 2.1.2

Keyboard-only users, including many screen reader users, switch device users, and people with motor disabilities, must be able to move through every part of a page without a mouse. A component that captures focus and never releases it (a 'keyboard trap') can strand these users entirely, sometimes forcing a full page reload just to escape. This criterion exists to guarantee that entering any widget never becomes a dead end.

How to Meet It

Test the entire page using only Tab, Shift+Tab, Enter, and Escape, with no mouse. Confirm focus can always move both into and out of every custom widget, embedded plugin, or iframe. Intentional focus containment (e.g., an open modal) is acceptable only if a documented, working exit exists, such as Escape or a visible close button. For any component where exiting genuinely requires more than standard Tab/arrow keys, tell the user what to press.

Code Examples

INCORRECT
document.getElementById('widget').addEventListener('keydown', function(e) {
  if (e.key === 'Tab') {
    e.preventDefault(); // Traps focus inside; Tab and Shift+Tab do nothing
  }
});
CORRECT
document.getElementById('widget').addEventListener('keydown', function(e) {
  if (e.key === 'Escape') {
    closeWidget();
    triggerButton.focus(); // Returns focus to a sensible location
  }
  // Tab and Shift+Tab are left untouched and move focus normally
});

Frequently Asked Questions

Are modal dialogs that trap focus within themselves a violation of 2.1.2?

No. Intentionally containing focus inside an open modal is an accepted pattern (per the WAI-ARIA Authoring Practices) as long as Escape or another documented keyboard method closes the modal and returns focus to a logical place. 2.1.2 targets unintentional traps with no documented exit, not deliberate, escapable focus containment.

What if exiting a component legitimately requires more than Tab or arrow keys, like Ctrl+Page Down?

WCAG permits this only if the user is advised of the specific method needed, for example through visible on-screen instructions or the component's accessible name/description.

Related Success Criteria

Quick Facts

  • Criterion2.1.2
  • LevelA
  • IntroducedWCAG 2.0

Automate Compliance

AccessiSight automatically scans and identifies 2.1.2 issues in your codebase.

Try Scanner Free