Single-page apps: announce page changes and move focus
Short answer: In a single-page app, clicking a link swaps the content without a real page load, so the browser does not do what it normally does on navigation: announce the new page title and reset focus to the top. Screen reader and keyboard users can be left stranded on a link that no longer exists, with no idea anything changed. After each route change, update the document title, move focus to the new page's main heading or content, and make sure the change is announced. Many frameworks help, but you still need to check.
What goes wrong
On a traditional website, every link loads a new page. Screen readers announce the new title, focus starts at the top, and keyboard users tab through the new content from the beginning.
Single-page apps built with frameworks such as React, Vue or Angular often skip all of that. The JavaScript router updates the URL and replaces part of the page, but from the browser's point of view nothing was loaded. Typical symptoms:
- A screen reader user activates "View order" and hears nothing; the content changed silently.
- Focus stays on the link that was clicked, or falls back to the start of the document in a way that feels random.
- The tab title still says "Dashboard" on the order page, so people with several tabs or using assistive technology lose track of where they are.
- Keyboard users have to tab through the whole header again to reach the new content, or worse, find focus stuck somewhere unexpected.
For business apps such as customer portals, booking systems and internal tools, these issues make core tasks hard or impossible for some users.
Three things to restore
1. A descriptive title for each view. WCAG's success criterion on page titles requires that web pages have titles describing their topic or purpose. In a single-page app, update document.title on every route change, for example "Order 4821 – Your account – Business name".
2. Sensible focus after navigation. WCAG's focus order criterion requires that focusable components receive focus in an order that preserves meaning and operability. After a route change, move focus to a logical starting point for the new view, usually its main heading or the main content container.
3. An announcement of the change. Screen readers need to know a new page has appeared. Moving focus to a heading with a clear name often achieves this, because the heading is read out. Some frameworks also add a hidden announcer.
Moving focus the right way
Headings and containers are not normally focusable. MDN explains that a negative tabindex, usually tabindex="-1", makes an element not reachable via sequential keyboard navigation, but it can still receive focus from script. So:
- Give the main heading of each view tabindex="-1".
- After the new view renders, call focus() on that heading.
- Remove any visible focus ring on the heading if it looks odd, but keep focus styles for interactive elements.
Some teams prefer focusing a "skip to content" target or the main element instead. Either works if it is consistent and lands users at the start of the new content.
Do not move focus on every update. Filters, tabs and "load more" buttons that change part of the page should leave focus where the user is, and announce results if needed.
Announcements with live regions
For changes that should be spoken without moving focus, such as "12 results found" after filtering or "Saved" after a form update, use a live region. MDN describes how the aria-live attribute marks a region whose updates screen readers should announce, with politeness settings of off, polite or assertive. Use polite for most messages so you do not interrupt the user mid-sentence.
Keep one live region in the app shell and update its text, rather than creating new ones on the fly, which some screen readers miss. Clear the message after a few seconds so an old notice is not read again when the same text is set twice.
What frameworks already do
Check your framework before writing your own solution. Next.js, for example, documents a built-in route announcer for client-side transitions: it looks for the page name to announce by first checking document.title, then the h1 element, then the URL path, and recommends a unique, descriptive title on every page. Other frameworks and routers have plugins or settings for focus and announcements. Even with these, test the result: an announcer that reads "Dashboard" on every page because titles are never updated does not help.
Testing
- Navigate the app with the keyboard only. After each link, press Tab once: you should land on the first interactive element of the new content, not back in the header.
- Use a screen reader such as VoiceOver, NVDA or TalkBack and check each navigation is announced.
- Check the browser tab title updates for every view.
- Include these checks in your regular release testing, since routing changes can quietly break them.
A worked example
Picture a hypothetical Tauranga property-management company with a tenant portal built as a single-page app. A tenant who uses a screen reader reported that after selecting "Maintenance requests", nothing seemed to happen, and the tab title always read "Portal".
The developers added per-view titles, set tabindex="-1" on each view's main heading and focused it after navigation, and added a single polite live region for messages such as "Request submitted". They then tested every main route with VoiceOver and NVDA. The tenant confirmed each page change was now announced, and keyboard users reached new content in one tab.
FAQ
Is this only a screen reader issue?
No. Keyboard users and people using magnification also rely on predictable focus.
Should focus go to the top of the page?
Usually to the start of the new main content, so users do not have to tab through repeated navigation.
Does server-side rendering fix it?
Only for the first load. Client-side navigation afterwards still needs the same handling.
If people using a keyboard or screen reader get lost in your web app, tell us which framework it uses.
Sources
- https://www.w3.org/WAI/WCAG22/Understanding/page-titled.html
- https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html
- https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/tabindex
- https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Guides/Live_regions
- https://nextjs.org/docs/architecture/accessibility