• Success Criterion 2.1.2
  • Conformance level A

Autocomplete List That Keeps Recapturing Focus on Every Blur

2.1.2 — No Keyboard Trap

Scenario

Setting

A pharmacy app's prescription-refill form

What’s wrong

Autocomplete listboxes that re-open and recapture focus on every blur.

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 an autocomplete listbox, then Tab away: if it reopens and recaptures focus on every blur, it fails.

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 pharmacy app's prescription-refill form, 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