pharos
pharos copied to clipboard
Leverage native dialog element for Modal
The problem
Modals present a number of accessibility challenges to get right, including:
- Focus trapping in the dialog itself
- Making the background content inert
- Announcing the dialog to screen readers
The solution
The native dialog element handles many of these challenges natively, reducing the code we need to manage ourselves. As the dialog and standards around it evolve, we won't need to react as often/deeply.
Additional information
This has wide support, but Safari only supports it as of 15.4—we'll need to wait just a bit until we no longer need to support older Safari versions.
Browser support has been fairly full for ~2 years now, so I suspect we are in a place to investigate making this move.