A keyboard trap occurs when a keyboard user navigates into a component or
region of a page and cannot navigate out of it using standard keyboard controls.
The user is stuck — Tab and Shift+Tab do not move focus away, and no other
key provides an escape route. This is one of the most severe accessibility
failures as it can render the rest of a page completely unreachable.
[1]
Intentional focus trapping inside an open modal dialog is correct and
required behaviour. Focus should not leave the dialog while it is open.
However the user must always be able to close the dialog — typically with
Escape — which releases the trap.
[2]
Accidental keyboard traps occur when a component intercepts Tab key
events without providing a way to exit. Common causes include:
Automated scanners cannot reliably detect keyboard traps — they require
operating the page by keyboard to discover.
[3]
Manual testing steps:
For modal dialogs:
Implement a proper focus trap that cycles focus within the dialog and
releases it when Escape is pressed or the dialog is closed.
For iframes:
Ensure the iframe title is set and that keyboard users can Tab out of
it naturally. Test with keyboard across browsers — iframe focus behaviour
varies.
For rich text editors:
If Tab is used for indentation, document this and provide Escape or
another key to exit the editor. Announce this to users via an accessible
instruction before or within the editor.
For third-party widgets:
Raise the issue with the vendor. As a temporary measure, consider
positioning such widgets so they appear at the end of the DOM tab order,
reducing the impact of any trapping behaviour.
[1]
Last edited Apr 5, 2026, 7:27 PM · P**** J****