Loading and Status Messages
What you'll learn: How to create visually hidden live regions that announce loading states and dynamic content changes exclusively to screen readers.
When content is loading or updating, sighted users see spinners, progress bars, or "Loading..." text. But screen reader users often experience complete silence during these state changes unless you explicitly announce them. The solution is to combine the visually hidden CSS pattern with live regions to create announcements that screen readers detect but don't clutter your visual design.
The Pattern
You create a dedicated container that's:
- Visually hidden using the clip pattern (not
display:none, which screen readers ignore) - Marked as a live region using
aria-liveor status/alert roles - Updated dynamically with text describing the current state
<div class="visually-hidden" role="status" aria-live="polite">
<!-- JavaScript updates this text -->
</div>
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
When to Use This
- Loading data: "Loading search results..."
- Processing actions: "Saving your changes..."
- Completion states: "20 results loaded"
- Error states: "Failed to load. Please try again."
Update the hidden region's text content when the state changes. For loading states, use role="status" or aria-live="polite". For errors or urgent updates, consider role="alert".
Think of this as a narrator for blind users—describing what sighted users would see happening on screen.
Key Takeaway: Visually hidden live regions bridge the gap between visual loading indicators and screen reader announcements, ensuring all users know when content is loading, processing, or has finished updating.