Must haves
- Semantic dialog markup and label
- Use
<dialog>
orrole="dialog"
for the container - Provide a descriptive
aria-label
or usearia-labelledby
to reference a heading in the dialog
- Use
- Focus management
- Focus moves into the dialog when it is triggered
- Focus stays within the dialog until it is dismissed
- Focus returns to a logical location when the dialog is closed
- Closable with ESC and a close button
Learn more about the accessible modal dialog pattern
Visual Example

Do and Don't
Do | Don't |
---|---|
<dialog aria-labelledby="dialog-title"> <button aria-label="close dialog">x</button> <h2 id="dialog-title">Update Profile</h2> … </dialog> |
Here there is no semantic markup to indicate the dialog role and a label for it. The close button also lacks a role and “x” is not a descriptive label for a button. The heading in the dialog fails to use a heading element. |