Skip to main content

What are Keyboard Traps?

Modified on: Fri, 8 Oct, 2021 at 3:50 PM

WCAG 2 guideline 2.1.2 states that there should be no keyboard traps. A keyboard trap occurs when a user can get into a component or element on a web page by using the keyboard but cannot get out of that component or element through the use of the keyboard.

Who Is Affected?

Keyboard traps primarily affect two types of users.

  • Users who are blind or who have a significant visual impairment cannot use the mouse for navigation. Consequently, their only method of navigating a web page is by using the keyboard.
  • Users who have limited or no use of their hands cannot navigate a page using the mouse. There are several ways in which these individuals can get around a page, but these methods primarily involve keyboard navigation in some form. For example, users of dictation software are actually giving keyboard commands to programs by using their voices.

How Can Keyboard Traps Be Avoided?

Awareness is the primary way to avoiding keyboard traps. Make sure that all elements of your web page can be gotten into, and out of, by using only the keyboard. Be especially mindful of this when using JavaScript and when embedding videos. Always approach your page with the question, “How can I navigate this page if I can’t use a mouse?”

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.