Home
Bookmarks
Leagues
LEARN
Courses
Career Paths
Assessments
Tutorials
Arcade
Glossary
GROW
Certifications
Log in
Glossary
Log inSign up
Courses/Accessible Interface Foundations/Keyboard paths and visible focus/
Exercise #5

Modal Dialogues: The Sacred Focus Trap

When a modal or dialogue opens, sighted users see a dark dimmed backdrop obscuring the background. But for a keyboard user, unless you trap focus, pressing Tab will navigate behind the modal into hidden background links and buttons!

The Three Mandatory Modal Focus Rules:

  1. Initial Focus Transfer: When the modal opens, immediately move keyboard focus into the first focusable element inside the modal (or the modal container itself).
  2. The Focus Trap: When focus reaches the last interactive element inside the modal, pressing Tab wraps focus back to the first element. Focus must never leak into the background page.
  3. Return Focus on Close: When the user closes the modal (via Escape or Close button), immediately restore focus to the trigger button that originally opened it.

Topics

Sequential Focus Navigation & DOM Order
The Crime of 'outline: none'
The Three Tabindex Rules: 0, -1, and Never > 0
Skip Links: Bypassing Blocks (WCAG 2.4.1)
Modal Dialogues: The Sacred Focus Trap
Escape Key Dismissal: WCAG 1.4.13 & 2.1.2
Composite Widgets: Arrow Keys vs Tab Key
Single-Page App (SPA) Route Transitions
Target Size & Spacing (WCAG 2.5.5 / 2.5.8)
Master Challenge: Auditing a Broken Modal Dialogue

From lesson

2

Keyboard paths and visible focus

Level 1 · Accessible interaction basics

Top contributors

Community contribution details will appear here once real learner activity is available.

Share