Skip to content
Performance & Accessibility

A Practical Guide to Focus Management in Single-Page Apps

Moving and announcing keyboard focus when a single-page application changes views without a full page load.

MediaScaleUp Editorial Team 2 min read 15 views
A Practical Guide to Focus Management in Single-Page Apps

The key figures

No page reload
browsers do not reset focus on client-side navigation
Announcements
route changes should be announced
Headings
moving focus to the new heading is a common pattern
Titles
document titles should update on navigation

Why this is worth getting right

Without focus management, screen reader users are left on the old content and keyboard users lose their place.

Do this, not that

Do

  • Move focus to the new view's heading on navigation
  • Update the document title for each view
  • Announce route changes politely
  • Restore focus sensibly when closing overlays
  • Test navigation with a screen reader

Don’t

  • Focus left on the previous link
  • Unchanged page titles between views
  • Focus jumped to the top with no context
  • Route changes only visible visually

When to bring in help

Our advice Bring in help when client-side routing must be accessible.

Where this comes from

The figures and practices above come from the sources listed.

Working on something like this?

We take on Performance & Accessibility work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.

Where to go next

Spotted something wrong? Report an error on this page. We correct on the page and say what changed.

All services

The work behind this article, and what it costs.

MediaScaleUp Editorial Team

Articles here are researched, written and checked by the MediaScaleUp studio team before they are published, and dated when they are reviewed.

Keep reading

More in Performance & Accessibility