Blog · 15 min read

Single Page App Accessibility: Focus, Routes and Testing

Tester listening to a screen reader

A single page app (SPA) is accessible when every view change does what a normal page load does for assistive technology: it moves focus to the new content, updates the page title, and tells screen reader users that something changed. Browsers do this for you on full page loads. In an SPA, your code has to do it.

This guide covers the problems SPAs create, the fixes that matter most, how to test them, and what to look for in a WordPress theme if your site is not an SPA at all.

AccessWiser
Find and Fix Accessibility Issues
AccessWiser scans websites against WCAG 2.2 AA criteria, links findings to affected elements, and provides plain-language guidance for fixes in your code.
Visit AccessWiser

TL;DR

  • SPAs swap content without a reload, so screen readers are not told a new page has opened. Your code must move focus, update the title, and announce the change.
  • On each route change, move focus to a predictable spot such as the new main heading, and set tabindex="-1" on elements that are not normally focusable.
  • Keep native HTML elements, real links and buttons, and visible focus styles. ARIA is a repair tool, not a starting point.
  • Automated scans catch many code-level problems but cannot judge focus order, announcements or whether the experience makes sense. Test with a keyboard and a screen reader as well.
  • An “accessibility-ready” WordPress theme is a good base, not proof that your site meets WCAG.

Table of Contents

Why SPAs break the way people expect pages to work

On a traditional site, clicking a link loads a new document. The browser resets focus, the screen reader reads the new page title, and the reader starts from the top. An SPA skips all of that. JavaScript fetches data and rewrites part of the screen, and the URL may change, but the browser sees one continuous document.

The Helsinki accessibility guidance on SPAs describes the core issue: because content updates without a full reload, screen readers do not automatically detect the navigation. Users are not informed of the change, and they can lose their place if focus is not handled correctly.

Focus is where most of the damage happens. According to Chrome’s Lighthouse documentation on managed focus, after a route change focus may be lost, reset to the body, or left on the old element. A keyboard user then has to tab through the navigation again, or worse, is sitting on a link that no longer exists.

The typical symptoms look like this:

  • A screen reader user activates “Pricing” and hears nothing. They do not know if the click worked.
  • A keyboard user presses Enter on a link, the view changes, and the next Tab press goes somewhere unrelated to the new content.
  • The browser tab still shows the old page title, so history menus and screen reader window lists are wrong.
  • A modal or drawer opens, but focus stays behind it and the user keeps interacting with hidden content.
  • A form submits, an error appears far down the screen, and no one is told it exists.

None of these are exotic. They happen by default in a framework app unless someone builds the behavior in.

Manage focus on every route change

The most useful single rule for SPA accessibility is this: after a view change, put focus somewhere deliberate. The Helsinki guidance says to move focus to a pre-designated spot in the new page, normally at the top, and to use tabindex="-1" when the element is not normally focusable.

The W3C’s developer module on rich applications frames the same expectations more broadly: support keyboard operation, place focus appropriately on new screens, and avoid unexpected changes of context during navigation.

Choose a focus target

You have three common choices, and each works if you apply it consistently:

Focus target Why teams choose it Watch out for
The new page’s <h1> Screen readers announce the heading, so focus and announcement happen together The heading needs tabindex="-1", and every view needs exactly one
The <main> container One rule covers every route Screen readers may read a large region, so give it an accessible name
A wrapper at the top of the view Lets you control what is read first Easy to forget in nested or lazy-loaded routes

The BBC’s GEL routing guidance recommends updating document.title when the route changes and notes that focusing the new screen’s heading also announces it to screen readers. That is a practical pattern: one focus move does two jobs.

A minimal pattern

In a React app using a router, the idea is small. On location change, set the document title, then focus the heading in the new view:

  1. Give each route a unique, descriptive title, such as “Pricing | Your Brand”.
  2. In an effect that runs on route change, set document.title.
  3. Find the view’s <h1>, make sure it has tabindex="-1", and call .focus().
  4. Skip this on the first load, where the browser already handles focus, and on changes that only alter a query string or hash and do not replace the view.

Vue and Angular have equivalent hooks, such as router navigation guards or navigation-end events. The framework matters less than the habit: every route calls the same shared function, so no screen ships without it.

Do not forget the back button

When a user goes back, the previous view should get the same treatment. Some teams restore focus to the link that opened the view, which is helpful for list-to-detail flows. Others send focus to the heading. Either is fine. Leaving focus on body is not.

Announce changes without noise

Moving focus is often enough. When it is not, such as when content updates in place without a route change, use a live region. The Helsinki guidance notes that developers can announce the new page title using a polite live region.

A few rules keep announcements useful:

  • Use aria-live="polite" so the announcement waits for the user to finish what they are hearing. Reserve assertive announcements for urgent errors.
  • Put the live region in the DOM when the page first loads, then change its text. Regions inserted at the same time as their content are often missed.
  • Keep messages short and meaningful: “Order summary loaded” beats a paragraph.
  • Do not announce what focus already announces. If you focus the new heading, a live region repeating the title makes everything read twice.

Status messages like “3 items in your cart” or “Form saved” are good candidates for a live region, because the user’s focus has not moved and they would otherwise get no feedback.

Keep the keyboard experience intact

SPAs often replace native behavior with custom components, and custom components are where keyboard access quietly fails.

  • Use real links and buttons. A div with a click handler does not receive focus, does not respond to Enter or Space, and has no role. Navigation should use <a href>. Actions should use <button>.
  • Keep focus visible. Many app stylesheets remove outlines. Under WCAG 2.2, focus indicators have to be noticeable. Our guide to 2px, 3:1 focus state accessibility shows how to build one that holds up.
  • Trap focus in modals, then release it. While a dialog is open, Tab should cycle inside it, Escape should close it, and focus should return to the control that opened it.
  • Offer a skip link. If your header repeats on every view, keyboard users need a way past it. See how to add a skip to content link in about ten minutes. The same bypass idea, with controls that work across screen sizes, comes up in this guide to responsive design.
  • Avoid surprise context changes. Selecting a dropdown option should not navigate away on its own. The W3C module lists unexpected context changes as something developers should avoid.

As a quick check, put your mouse aside and complete your top three tasks: sign up, buy, contact. If you get lost at any point, a screen reader user will too.

Use semantics first, ARIA second

Search results for SPA accessibility are full of advice to add ARIA roles everywhere. ARIA helps when native HTML cannot express what a component does, such as tabs, comboboxes or tree views. It does not add keyboard behavior, and a wrong role is worse than no role because it promises behavior that is not there.

A safer order of operations:

  1. Use the right HTML element: nav, main, button, a, label, h1 to h6.
  2. Add landmarks so users can jump between regions.
  3. Build any custom widget to a documented pattern, with the matching keyboard support.
  4. Add ARIA only where steps 1 to 3 leave a gap, and test it with a screen reader.

Heading structure matters as much in an SPA as anywhere. Because views are assembled from components, it is easy to end up with two h1s, or a section that jumps from h2 to h5. Review the heading outline of every route, not just the home page.

Should you pre-render?

Some of the loudest critics of SPAs argue that sites should work without client-side JavaScript for core paths. Server-side rendering or pre-rendering can help: content is present on first load, pages are reachable by link, and users with slow connections or script failures still get something usable. Whether it is right for your project depends on your stack. If your site is mostly content, such as a restaurant menu, a clinic’s service pages or a law firm’s practice areas, a conventional multi-page site, or a framework with server rendering, removes a whole class of problems. If it is a true application, the focus and announcement work above is the price of entry.

Test an SPA for accessibility

Automated tools are the right first layer for an SPA. They find missing alt text, unlabeled form fields, low contrast, empty buttons and invalid ARIA across many pages quickly, and they can run again after every release. Automation cannot tell you whether focus lands somewhere sensible after a route change, whether an announcement is helpful, or whether a custom widget is usable. That is why a good SPA test plan has layers.

Four layers of SPA accessibility testing

Layer 1: Automated scans on every route

Scan each distinct view, and each important state: the open modal, the error state, the empty cart. A scanner that only loads your home URL will miss most of an SPA. Build scans into your release process so regressions are caught early.

Layer 2: Keyboard walkthrough

For each key flow, check:

  • Can you reach and operate every control with Tab, Shift+Tab, Enter, Space and arrow keys where expected?
  • Is the focus indicator always visible?
  • After each navigation, where is focus? Is it on the new heading or container?
  • Can you escape from every modal or menu?

Layer 3: Screen reader pass

Try at least one screen reader and browser pairing your audience is likely to use, such as NVDA with Firefox or Chrome on Windows, or VoiceOver with Safari on Mac and iPhone. Navigate between two routes and listen. You should hear the new title or heading without hunting for it. Fill in a form with an error and check that the error is announced and reachable.

Layer 4: Zoom, spacing and motion

Zoom to 200 percent, then 400 percent, and make sure nothing is cut off or overlapping. Test the text spacing overrides, since fixed-height containers are common in app layouts. Respect the reduced motion preference for animated route transitions.

Record what you find

Write down what you tested, when, and what you fixed. Dated records are useful for your own team and, if you ever receive an ADA demand letter, for showing sustained effort. Our piece on ADA versus WCAG explains how those two relate in practice.

Our perspective on SPA accessibility

We see the same pattern on single page apps again and again: the scan passes on the home page, and the real problems sit in the transitions between views. A scanner can tell you that a button has no name. It cannot always tell you that focus vanished after a click. That is why we built AccessWiser around code-level findings, each tied to the specific element and WCAG 2.2 AA criterion it affects, with plain-language guidance for fixing it in your own code.

We also believe in permanent remediation. A runtime patch can mask a symptom for a visitor, but the focus handler, the heading and the label still need to be right in your source. Automated checks detect a substantial subset of barriers, and we say so openly. Pairing them with scheduled re-checks catches the regressions that creep in each time a component is changed, and dated records of scans and fixes give you evidence of your efforts.

Accessibility is a team effort between developers, content managers and owners. When each person can see what is wrong and how to fix it, everyone ships more inclusive experiences.

The AccessWiser Team

Not building an SPA? Choosing a WordPress theme

Many readers who search for SPA accessibility are also asking about WordPress themes, because the theme controls much of the navigation, headings and focus styling. If you run WordPress, the theme is your foundation.

What accessibility-ready means

WordPress runs a review program for themes that carry the accessibility-ready tag. Its theme requirements include skip-to-content links, meaningful landmark roles, proper heading structures and keyboard-only navigation. Themes also need accessible form labels and sufficient color contrast, and they must not depend on inaccessible plugins.

The requirements were revised recently. The May 6, 2026 update added expectations for reflow, resizing and text spacing changes, no unexpected changes of context, and accessible content on hover or focus. The guidelines now include only requirements: some former recommendations became requirements, and others were dropped as best practices that do not block approval. The update also adds step-by-step testing guidance.

What accessibility-ready means

The WordPress theme developer handbook adds that skip links let users bypass page areas and that controls must work with the keyboard on all screen sizes.

A short checklist for picking a theme

  1. Filter the theme directory for the accessibility-ready tag.
  2. Open the demo and press Tab. A skip link should appear first, and focus should always be visible.
  3. Open the menus with the keyboard only, including submenus and the mobile menu.
  4. Check the heading outline on the demo’s home page and a post.
  5. Look at text and button contrast, then zoom to 200 percent.
  6. Test the search form, comment form and any forms with a screen reader.

The tag is a starting point

The handbook explains that the tag means the theme reached the review team’s minimum standards, not WCAG AA conformance. The May 2026 update also describes themes as a wrapper for content, and says WCAG does not apply directly to themes. Your posts, images, plugins, page builder blocks and embedded widgets all add their own barriers. For ongoing work, use our WordPress accessibility checklist and the guide to fixing WordPress accessibility errors at the code level. If your theme offers a dark mode, review what helps and what hurts before enabling it.

Common SPA mistakes to fix first

If you have limited time, start with the issues that block people entirely:

  • No focus management on route change. Add one shared function and call it from every route.
  • Static document title. Give each view its own title.
  • Clickable divs instead of links and buttons. Replace them.
  • Modals without focus handling. Trap, close on Escape, and return focus.
  • Errors that appear silently. Move focus to an error summary or announce it politely.
  • Missing labels and names. Every input, icon button and link needs an accessible name.
  • Removed focus outlines. Restore a visible indicator.

Then move to the details: heading levels, landmark names, reduced motion, and text resizing.

Monitor after you ship

SPAs change often. A new component library version, a redesigned header or a content update can undo last month’s fix. Schedule re-checks so regressions show up quickly, and keep your fixes documented. Our own approach is to scan against WCAG 2.2 AA, with Section 508 and EN 301 549 mappings, then give you guidance for fixing each issue in your code.

Plans start at $24 per month for Starter, with Basic at $49 per month and Pro at $119 per month. Business is a custom plan. Extra specific page scans are $12 one-off and extra full site scans are $19 one-off. Every plan begins with a 7-day free trial. See the AccessWiser pricing page to compare them, or browse the AccessWiser blog for more developer guides. If your site includes a visitor-facing widget, read the vendor checks for accessibility widgets first.

FAQ

Are single page apps bad for accessibility?

Not inherently, but they do not get the browser’s built-in page-change behavior. Teams have to add focus management, title updates and announcements themselves. When they do, an SPA can be just as usable as a multi-page site.

Where should focus go after a route change in an SPA?

Send it to a predictable spot at the top of the new view, usually the main heading or the main container. Use tabindex="-1" if the element is not normally focusable. Also update the document title so the change is clear to screen reader users.

Can automated tools fully test an SPA?

No. Automated checks reliably catch many code-level issues, such as missing names, contrast problems and invalid ARIA. They cannot fully judge focus order, announcements or whether a custom widget is usable, so pair scans with keyboard and screen reader testing.

Does an accessibility-ready WordPress theme make my site compliant?

No. The tag means the theme meets the review team’s minimum requirements. It is not a WCAG AA conformance claim, and your content, plugins and customizations still need checking.

Sources

Articles on this blog are general information about web accessibility, not legal advice. Laws change and their application depends on your specific situation — for decisions with legal consequences, consult a qualified legal professional.

Articles on this blog are general information about web accessibility, not legal advice. Laws change and their application depends on your specific situation — for decisions with legal consequences, consult a qualified legal professional.