• Success Criterion 2.1.2
  • Conformance level A

Modal Focus Trap With No Escape Key or Close Button

2.1.2 — No Keyboard Trap

Scenario

Setting

A car-rental site's checkout flow

What’s wrong

Modal focus "trap" with no Esc/close reachable by keyboard (intended trap, missing exit).

Example

// modal traps Tab inside with no Escape handler

Why it matters

All keyboard and screen-reader users who can become stuck inside a component.

How to test

Tab into the component that's intentionally modal: confirm there IS a working Esc or visible close control — if neither exists, it's an unescapable trap.

How to fix

Focus must always be able to leave the component using Tab/Shift+Tab or Esc (or a standard method the user is told about). document.addEventListener('keydown', e => { if (e.key === 'Escape') closeModal(); }); Any component that captures focus needs a standard way out — Escape, or focus cycling back to a close control.

Outcome

On a car-rental site's checkout flow, this barrier is gone for all keyboard and screen-reader users who can become stuck inside a component — they get the same result as anyone else here.

Who is affected

All keyboard and screen-reader users who can become stuck inside a component.

Learn more