Start scanning free

( Operable / WCAG 2.1.2 )

Focus is trapped inside a component

This check maps to No Keyboard Trap. Use the guidance below to confirm the issue, understand who it affects and ship a fix.

Serious Level A WCAG 2.1.2 — No Keyboard Trap

What’s wrong

Keyboard focus enters a component such as a modal or menu and cannot be moved out — the user is stuck.

Why it matters

Keyboard users who cannot escape a component are completely blocked from using the rest of the page.

How to fix it

Modals must allow Escape to close and return focus to the trigger element. When closed, remove the focus trap. Use a focus management library or implement a focus sentinel pattern.

Before
<!-- Modal with no Escape handler and no focus management -->
After
<!-- Modal closes on Escape, returns focus to trigger button -->

Learn more