Skip to content

Keyboard trap

A keyboard trap leaves keyboard users stuck within a region. Deliberately containing focus in a dialog needs a keyboard-operable exit.

Design & UX

A keyboard trap occurs when someone can reach a region using the keyboard but cannot leave it using the keyboard. A mouse pointer outside the region does not help people who depend on keyboard interaction.

Be able to leave a dialog

In a fictional portal, focus stays inside a confirmation dialog while it is open. Keeping focus there is not itself a keyboard trap. The person should be able to make the decision or close the dialog through an understandable keyboard route. They must then be able to continue using the interface.

Test the complete route

W3C distinguishes an inescapable trap from containment with a known exit. A special exit mechanism needs a suitable explanation if it goes beyond the usual keyboard methods. Check entering, operating and leaving the region. A visible close button is not enough if it cannot be reached using the keyboard.

Sources

Articles on this topic

Design & UX with ASES

User experience, interfaces and brand presence