You click "Add to Cart" and a little notification pops up: "Item added!" You submit a form and see "Thank you, your message has been sent." You start typing in a search box and results appear below as you type. These instant feedback messages are everywhere on modern websites - but are they accessible to everyone?
For sighted users, these visual cues are obvious. But for someone using a screen reader, these dynamic updates can be completely invisible unless they're coded properly. The page content changed, but their screen reader said nothing about it.
The Standard
WCAG 4.1.3 Status Messages - In content implemented using markup languages, status messages can be programmatically determined through role or properties such that they can be presented to the user by assistive technologies without receiving focus.
The key phrase here is "without receiving focus." When something updates on your page - a success message, an error, a loading indicator, search results - screen reader users need to know about it, but you don't want to interrupt what they're doing by moving focus away from where they are.
What Counts as a Status Message?
Status messages include:
- Success confirmations - "Your changes have been saved"
- Error messages - "Please enter a valid email address"
- Progress indicators - "Loading..." or "Processing payment"
- Result counts - "5 items found" or "Showing 1-10 of 234 results"
- Updates to cart or wishlist - "Item added to cart"
- Warnings - "Your session will expire in 2 minutes"
What doesn't count:
- Changes that receive keyboard focus (like opening a dialog box)
- Changes that are part of the current focused element updating (like characters appearing as you type)
- Messages that appear on page load
How Status Messages Work
The magic behind accessible status messages is ARIA live regions. These are special attributes you add to HTML elements that tell screen readers "watch this area for changes and announce them."
The Basic Approach
The simplest way to create an accessible status message is using the role="status" attribute:
<div role="status">Your changes have been saved.</div>
Or for more urgent messages, use role="alert":
<div role="alert">Error: Please correct the highlighted fields.</div>
The difference? Status messages are announced politely - the screen reader will wait until it finishes whatever it's currently saying. Alerts interrupt immediately, so use them sparingly for truly urgent information.
ARIA Live Regions
Behind the scenes, these roles use ARIA live region properties. You can also use these directly:
aria-live="polite"- announces when screen reader is idle (same as role="status")aria-live="assertive"- announces immediately (same as role="alert")aria-live="off"- don't announce (the default)
You can combine this with:
aria-atomic="true"- announce the entire region, not just what changedaria-relevant="additions text"- announce only additions and text changes
Status Messages in Drupal
Drupal has a special Javascript function for Aural announcements - Drupal.announce() which I only learned about while researching for this post! This function automatically creates an ARIA live region:
Drupal.announce('Your changes have been saved.');
This creates a visually-hidden ARIA live region that screen readers will announce without moving focus. It's designed specifically for dynamic updates that happen without page refresh - like inline form validation, AJAX responses, or progress indicators.
Toast Notifications
Toast notifications - those little popup messages that appear briefly and then fade away - are incredibly popular in modern web design. But they're often an accessibility nightmare.
Common Toast Problems
- They disappear too quickly - before screen reader users hear the full message
- They're not announced at all - missing ARIA live regions
- They can't be dismissed - no close button for keyboard users
- Multiple toasts overlap - creating a confusing mess
Making Toasts Accessible
If you're using toast notifications:
- Add
role="status"orrole="alert"to the toast container - Keep messages on screen long enough to read - at least 5 seconds, or until dismissed
- Provide a visible close button that's keyboard accessible
- Don't auto-dismiss error messages - let users dismiss them manually
- Stack multiple toasts logically rather than overlapping them
- Consider whether a toast is really the right pattern - sometimes a persistent message area is better
Many JavaScript libraries now include accessibility options, but you need to configure them properly:
- React-Toastify - includes ARIA roles and keyboard shortcuts
- Notyf - lightweight with ARIA support
- Toastr - popular but requires manual ARIA configuration
- htmx-toasts - web component for HTMX with ARIA support built in
For Vue applications specifically, vue-toastification has built-in accessibility options where you can configure the role attribute and aria-label for the close button, and allows you to control toast duration and dismissal.
For Drupal sites using HTMX (which is coming to Drupal 11.3 core!), htmx-toasts provides a clean pattern - the server sends toast messages via response headers, and the web component handles displaying them with proper ARIA attributes. This server-driven approach fits naturally with Drupal's messaging system.
Testing Status Messages
Testing status messages requires actually using a screen reader. Here's how:
- Turn on a screen reader (NVDA on Windows, VoiceOver on Mac, Orca on Linux, TalkBack on Android)
- Navigate to a form or interactive element
- Trigger an action that should show a status message
- Listen - does the screen reader announce the message?
- Did it interrupt what you were doing, or announce politely?
You can also use browser developer tools to inspect ARIA attributes and make sure they're present.
The Bottom Line
Status messages are about keeping all users informed. Visual feedback is great, but it's only half the picture. By properly implementing ARIA live regions and being thoughtful about timing and urgency, you ensure that everyone knows what's happening on your site - whether they can see the screen or not.
Next time you add a notification, toast, or status message to your site, take a moment to test it with a screen reader. You might be surprised by what you discover!
Add new comment