Black Lives Matter. Support the Equal Justice Initiative.
Skip to main contentCarbon Design System

Notification

How it works

Notification Carbon components are messages that communicate information to a user. The WAI-ARIA role="alert" is equivalent to aria-live="assertive". It is used to display a message to the user in a way that attracts the user’s attention without receiving focus to communicate the message without interrupting the users current task. If the notification does not contain an urgent message, consider changing it to aria-live="polite" so the notification is queued until whatever task the user is currently working on is complete.

The close button contains an ARIA label of aria-label="close", and the icon has aria-hidden="true" so it is ignored by assistive technologies. The Tab key is used to move focus to the close button within the notification and the Space key or Enter key activate the button to close the notification.

Accessibility considerations

  1. Avoid using a toast notification for critical alerts or long messages because they are timed and will disappear automatically making it difficult for people with various disabilities to get the entire message. An alert that disappears too quickly can lead to failure of the optional WCAG 2.0 success criterion 2.2.3 (AAA).

  2. Provide a means to turn off nonessential alerts to enhance usability for people with visual and cognitive disabilities. Additional information is available in WCAG 2.0 success criterion 2.2.4 (AAA). Note: Providing this functionality is optional.

  3. Ensure the use of color and hidden icons are not used as the only means of conveying the importance of the notification.

Resources

Helpful resources for creating customized accessible implementations

Accessibility testing

Accessibility issues are tracked in the Carbon Component GitHub repository.

Automated test

Automated test environment
Results
- macOS Mojave version 10.14.6 with VoiceOver
- Chrome version 77.0.3865.90
- Dynamic Assessment Plugin version 1.8.0.0 - IBM Accessibility WCAG 2.1 Sept. 2019 Ruleset
- Carbon React version 7.7.1
DAP Test
- Violations

macOS screen reader tests

Environment
Results
- macOS Mojave version 10.14.6 with VoiceOver
- Chrome version 77.0.3865.90
- Carbon React version 7.7.1
VoiceOver(VO) test:
  1. Press Control-Option-Shift keys to enter the Web content.
  2. Press the Tab key. VO announces the notification text and the close button.
  3. Press the Space key or Enter key to close the notification.
- macOS Mojave version 10.14.6 with VoiceOver
- Safari version 13.0.2
- Carbon React version 7.7.1
VoiceOver(VO) test:
  1. Press Control-Option-Shift keys to enter the Web content.
  2. Press the Tab key. VO announces the notification text and the close button.
  3. Press the Space key or Enter key to close the notification.

Windows screen reader tests

Environment
Results
- Microsoft Windows 10
- Firefox version 68
- JAWS version 18
- Carbon React version 7.7.1
JAWS test:
  1. Press H, JAWS announce the notification title.
  2. Press Alt-Down Arrow, JAWS announces each line of the notification text.
  3. Press the Tab, JAWS announces the close button.
  4. Press the Space key or Enter key to close the notification.

iOS screen reader tests

Environment
Results
- iOS version 13.1.3 with VoiceOver
- Safari version 13.1.3
- Carbon React version 7.7.1
VoiceOver test:
  1. Swipe right to the notification and to read the notification text.
  2. Swipe right to the X icon. VO announces the close button.
  3. Double tap to close the notification.