Improving accessibility on Alert and Modals
See original GitHub issueI was wondering if we should change role="alert" to role="alertdialog" on dismissible alerts since W3C alert role specs read:
If an alert requires focus to close the alert, then content authors SHOULD use alertdialog instead. https://www.w3.org/TR/wai-aria/roles#alert
And according to MDN on role=“alert”:
If an alert also provides interactive controls (such as form controls that allow the user to rectify a problem, or an “OK” button that discards the alert) the
alertdialogrole should be used instead. https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_alert_role
This would mean wrapping the text with a div with an id and adding an aria-describedby which I don’t quite like but on modals we have plenty of hooks to make it more accessible.
This was also mention here #22429
What do you think? Should I introduce this idea as a PR?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (3 by maintainers)

Top Related StackOverflow Question
Yeap. sorry 😦 autofill kills me sometimes, sorry Pablo.
@pablocrivella Let’s rethink this. After re reading: https://www.w3.org/TR/wai-aria/roles#alertdialog
I don’t think that:
Is not accurate to an alert since the rest of the page should still be clickable, an alert is definitely not a modal.
I’ve also read strong opinion against using
alertdialog: https://www.marcozehe.de/2015/02/05/advanced-aria-tip-2-accessible-modal-dialogs/Should we just close this issue for now?