Skip to content
Bugwise
Menu

Focus trap

Keeping keyboard focus inside an open modal so users can't tab into the hidden page behind it.

Definition

When a modal is open, keyboard focus should move into it, stay inside it while it is open, and return to the element that opened it when it closes. Without this, keyboard and screen reader users get lost in content they can't see.

In practice

Pressing Tab repeatedly in a "Cookie settings" dialog should cycle through its buttons only, never reaching the links on the page underneath.

Learn it in context

Lessons that use this term.

Related terms

Esc

Type to search the whole site.