Text
Alert
Published on
Description
Alerts communicate urgent or important messages to the user. They are announced immediately by screen readers via live regions.
Use alerts for time-sensitive or critical information. For non-urgent contextual information, use a callout instead.
Example
Accessibility
- Use
role="alert"for assertive announcements that interrupt the current screen reader output. - Use
role="status"(oraria-live="polite") for non-urgent status updates that wait for a pause in speech. - The
role="alert"rarely produces the expected "alert" prefix announcement across screen readers — test with multiple assistive technologies. - Live region elements must exist in the DOM before content is injected for announcements to fire.
- Prefer
aria-live="polite"as the default. Reserveassertivefor critical, time-sensitive information.
References
- Live Region Support (opens in new tab) — Adrian Roselli
Related
- Callout — for non-urgent contextual information
- Form errors — for field-level error announcements
Variables
None for alert