Notification component's role="alert" creates accessibility issue for screen reader users
See original GitHub issueReproduction link
Steps to reproduce
- Open example.
- Click button to open notification box.
What is actually happening?
Since role="alert"
is used, the notification interrupt whatever the user is doing. This also stops a screen reader from finishing whatever it was saying before the alert interrupted it (and will not pick up where it left off) which can make a user feel stranded. Toast-style notifications should be used for non-critical, non-interactive content so it’s inappropriate to use role="alert"
which implicitly has an aria-live
value of assertive
.
What is expected?
Instead, role="status"
is more appropriate as it allows for current screen reader announcements to be read before announcing the non-critical notification content. This requires the notification elements to be with an element with role="region"
and aria-live="polite"
.
Environment | Info |
---|---|
antd | 4.24.5 |
React | React |
System | Windows 10 |
Browser | All |
More information:
Issue Analytics
- State:
- Created 9 months ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
ARIA: alert role - Accessibility - MDN Web Docs - Mozilla
The alert role is used to communicate an important and usually time-sensitive message to the user. When this role is added to an...
Read more >Accessibility - Notification - Carbon Design System
The role of status , log , and alert can not contain interactive elements, should not be given focus, and can optionally be...
Read more >Noticing screen readers using alert role - ADG
Setting role="alert" to a newly added DOM element (using JavaScript) forces the screen reader to announce its content, regardless of what it is...
Read more >Provide notification of dynamic changes to content
Listen to the page with a screen reader. Are notifications made in an accessible way, including making users aware of important changes in...
Read more >HTML5 Accessibility Chops: ARIA role=alert browser support
When an element has a role=alert is displayed it triggers an alert event in the browsers implemented accessibility APIs. This is picked up...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, @mellis481 @dgreene1 @MadCcc I have pushed a PR to add a
role
prop to notification component, please review it. https://github.com/ant-design/ant-design/pull/39611@MadCcc The difference is succinctly described in the “What is actually happening?” and “What is expected?” sections above.