Level A · WCAG 2.0

2.1.2 No Keyboard Trap

Focus can always move back out of a component using the keyboard alone.

Partly automated Some failures are detectable, others need judgement.

How it fails in practice

A cookie banner that traps focus with no reachable close button. An embedded map that swallows Tab and never gives it back.

How to fix it

Modal dialogs should hold focus and release it on Esc. Everything else should let focus pass straight through.

At a glance

Level
Level A — the minimum. Failing one of these usually makes something impossible rather than merely hard.
Principle
Operable
Guideline
2.1 Keyboard Accessible
Added in
WCAG 2.0
EN 301 549
9.2.1.2
Automated check
Partly automated

Read the official definition at W3C

Partly automated

How far an automated check gets

A tool finds some failures here and cannot see the rest. A clean automated result means the checks that exist found nothing — not that the criterion is met. This is the gap that makes a green scan look like an accessible site, and it is where the keyboard agent, the agents still in development and a human reviewer do the remaining work.

A trap is found where the agent walks: the journeys you name and, on a crawl from an account, one page of each template and what opens there. A trap anywhere else stays undetected — which is why the report names the journeys it covered.

Rules that check this criterion

The rule ids are axe-core’s (version 4.14.0), the open-source engine our scan runs, and our keyboard agent’s — the names a report or a CI log will show. An underlined id has a page of its own here.

All rules, explained

Where it matters most

The guides that list it among the criteria to check first.

Related criteria

Other criteria under the same guideline.

All WCAG 2.2 AA criteria

Further reading

  • Keyboard agent

    Keyboard accessibility testing with real keys: the agent tabs through your pages, finds keyboard traps and invisible focus, and records every step.

  • Keyboard trap

    A component keyboard users can move into but not out of (WCAG 2.1.2, Level A).

  • keyboard:trap

    A keyboard trap holds focus so Tab, Shift+Tab and Escape cannot leave. Why widgets cause it, how to fix it and how to test it, with code example.

Find out which criteria your site fails

We scan up to 100 pages against WCAG 2.2 AA, send the keyboard agent through the page you name and email you the report — free, once, no strings.

Get a free scan See how the agent tests

Report within one working day.