The WCAG Explained

Simplified and actionable explanations of every WCAG 2.2 criteria

No Keyboard Trap

Summary:
WCAG 2.1.2, "No Keyboard Trap," is crucial for ensuring that users navigating a website or application with a keyboard can do so smoothly, without getting stuck on any element. This guideline is especially important for users who rely on keyboard navigation due to physical disabilities, visual impairments, or personal preference.

What:
This criterion mandates that when a user navigates through a site or app using a keyboard, they should never be trapped in a part of the content. Users must be able to move their focus forward and backward without needing a mouse.

Why:
Keyboard traps create a significant barrier, essentially locking users into a portion of a site or app and preventing them from accessing other parts. This can be frustrating and limiting, especially for users who cannot switch to a mouse to escape these traps. Ensuring smooth keyboard navigation respects user autonomy and accessibility.

Examples and Scenarios:

  1. Modal Dialogs: When a modal dialog opens, users should be able to close it or move to the next element using keyboard commands.
  2. Embedded Media Players: Users navigating through embedded media players should be able to continue to the rest of the page without getting stuck in the player controls.
  3. Interactive Forms: In complex forms, users should be able to navigate through all form fields, buttons, and other elements without getting trapped in any part of the form.

How to Comply:

  • Websites: Regularly test your website to identify and rectify any potential keyboard traps. Ensure that all modal windows, overlays, and embedded content can be exited or navigated through using a keyboard.
  • Mobile Apps: Although primarily touch-based, ensure that users navigating with external keyboards can move through all elements without getting stuck.
  • Software Applications: Design interfaces so that all interactive elements, including custom controls and widgets, can be navigated in sequence using keyboard inputs.

Exceptions:

  • Complex Interactions: Certain highly interactive tasks, like map navigation or complex games, might inherently present challenges. However, even in these cases, strive to provide a means of keyboard-based navigation or an alternative method to access the content.