Client-Side Routing Announcements
What you'll learn: How to announce page changes to screen reader users when your single-page application navigates between routes without triggering a full page reload.
The Problem with Silent Navigation
In traditional websites, every navigation triggers a full page refresh—the browser reloads, and screen readers automatically announce the new page title. But in single-page applications (SPAs), clicking links often just swaps content via JavaScript while staying on the same page. To a screen reader user, this silent transition is confusing. They might not realize the page changed at all.
Think of it like this: Imagine walking through a building where each room change is announced over a speaker. Now imagine those announcements suddenly stop, but you're still being moved between rooms. You'd be disoriented.
The Solution: Manual Announcements
When your router changes views, you need to manually announce the change using a live region with role="status" or aria-live="polite". This mimics what happens during traditional page loads.
The typical pattern:
- Place a visually-hidden live region in your app's root
- When routes change, update that region with the new page title or heading
- The screen reader announces the change automatically
<div role="status" aria-live="polite" aria-atomic="true" class="visually-hidden">
<!-- Dynamically update this text on route change -->
</div>
When navigating from /home to /about, update the announcement region with something like: "About page loaded" or simply "About".
Combining with Focus Management
For best results, pair announcements with focus management (moving focus to the main content heading or container) so keyboard users also perceive the navigation clearly.
Key Takeaway: In single-page applications, use live regions to announce route changes, replacing the automatic announcements that screen reader users would receive from traditional page loads.