System Design · Middle · Question 50 of 75
How do you manage focus when opening a modal in an SPA?
- ✓Correct answer: Move focus inside, trap it and restore it after closing
- 2Leave focus on the page beneath the modal
- 3Remove focus from all elements with
outline: none
Explanation
Without focus management, keyboard and screen reader users get lost. The native <dialog> with showModal() does most of the work. At the system level, this is built into the design system's base components.