You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(notifications): replace role="alert" with aria-live="polite" (#268)
* fix(a11y): replace role="alert" with aria-live="polite" for
Notifications
* fix(Notification): warning uses alert role
* docs(Notification): usage for alert roles and aria-live
Copy file name to clipboardExpand all lines: src/components/notification/README.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,3 +41,26 @@ Use these modifiers with `.bx--inline-notification` class.
41
41
| selectorButton |`[data-notification-btn]`| The selector to find the close button in the component |
42
42
| eventBeforeDeleteNotification |`notification-before-delete`| Event before deleting the notification |
43
43
| eventAfterDeleteNotification |`notification-after-delete`| Event after deleting the notification |
44
+
45
+
46
+
### FAQ
47
+
48
+
#### Using aria live regions and alert roles
49
+
50
+
Using `role="alert"` is an aggressive call to action that the prompts a screen reader user to take immediate action on something that changed in the UI. This is usually reserved for things that are important or time-sensitive like:
51
+
52
+
- An invalid value was entered into a form field
53
+
- The user's login session is about to expire
54
+
- The connection to the server was lost, local changes will not be saved
55
+
56
+
Use the alert role sparingly and only in situations where the user's immediate attention is required.
57
+
Dynamic changes that are less urgent should use a less aggressive method, such as `aria-live="polite"` or other live region roles.
58
+
59
+
Don't use an alert role on all notifications.
60
+
61
+
By default, we recommend that error and warning notifications use `role="alert"`, while success and info notifications use `aria-live="polite"`.
62
+
But as always, this will depend on the urgency of the notification.
63
+
64
+
**Sources:**
65
+
-[Use the alert role - MDN](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_alert_role)
66
+
-[ARIA Live Regions - MDN](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions)
0 commit comments