Skip to content

Accessibility

A notification is a live message, so it follows the WAI-ARIA Alert pattern and meets WCAG 2.1 AA. An accessible notification is announced without losing the user’s place, stays on screen long enough to read and act on, and never depends on colour alone.

  • Text, icons and controls must meet accessible contrast on every type’s fill. Source: WCAG 1.4.3 Contrast (Minimum).
  • Never convey severity by colour alone: combine the icon with text that names the problem. Source: WCAG 1.4.1 Use of Color.
  • Never make auto-dismiss the only way to reach important content. Prefer manual dismissal for a notification with actions. Source: WCAG 2.2.1 Timing Adjustable.

Choose the role by urgency. A toast or other non-critical notification uses role="status", which is announced politely. A critical error or blocking notification uses role="alert", which interrupts the screen reader, so use it sparingly and never for informational or success messages. Source: WCAG 4.1.3 Status Messages.

Screen readers only announce changes to a live region they already know about. For a notification that appears dynamically, keep the empty live region in the DOM and update its content in place, rather than creating the region along with the message. The Toast recipe on the CSS tab shows this wiring.

If a notification auto-dismisses, pause the timer on hover and on focus. Source: WCAG 2.2.1 Timing Adjustable.

Key Action
Tab / Shift + Tab Move through the notification’s links and buttons
Enter / Space Activate the focused link or button
Escape Dismiss a dismissible notification while focus is inside it

A notification doesn’t take focus when it appears, so Tab reaches its controls in reading order: the inline link, the close button, the standalone link, then the button. The exception is an actionable notification that needs an immediate decision: move focus to its first control when it opens, and return it to the trigger on close. Source: WCAG 2.4.3 Focus Order.

Title Description Link

Body text that adds context.

Link
  1. Inline link
  2. Close button
  3. Standalone link
  4. Tertiary button

Give every element the role, name and state assistive technology needs.

Icon

The icon carries aria-hidden="true", since the text must already convey the severity. If it doesn’t, add the severity to the text, such as “Error:”.

Close button

An icon-only button has no text to name it, so give it an aria-label, such as “Dismiss”.

Field message

An inline notification tied to a form field is also referenced from that field’s aria-describedby, in addition to role="alert" when it reports a validation error.