Returning Focus When a Layer Closes
Restore the user to where they left off.
Layers Borrow Focus
When a modal, menu, or drawer opens, focus moves inside it. When it closes, you are responsible for returning focus to where the user was.
The Lost-Focus Problem
If a closed layer leaves focus on a removed element, it falls back to the page body. The user is stranded with no sense of place.
All lessons in this course
- tabindex 0, -1, and Never Positive
- Moving Focus After an Action
- Returning Focus When a Layer Closes
- Managing roving tabindex in Widgets