Recent chats
ASKGEEZ Q&A GUIDETechnology & devices

How can I support keyboard navigation in a single-page website?

Quick answer

After a single-page website changes views, make the new view identifiable and decide deliberately whether focus should move. For a substantial route change, consider moving focus to the new view’s main heading; for a small update, keeping focus where it is may better preserve the user’s place. Update the document title when the view changes, and test the result with keyboard navigation. These are practical design choices, not a complete route-change standard.

LET’S WORK THROUGH IT

The question, the details, the next step.

Question

When someone activates a link in my single-page website, what should happen to keyboard focus? I want the new view to be discoverable without making the experience disorienting.

Geez

Start by distinguishing a substantial route change from a small in-place update. For a substantial change, consider moving focus to a clear target at the start of the new view, often its main heading. That gives keyboard users a deliberate starting point rather than leaving them at a control associated with the previous view. For a small update, moving focus may be unnecessary; it can be less disruptive to keep focus on the control that initiated the change.

Treat this as a design plan to test, not a universal rule supplied by the references. MDN advises that sequential keyboard focus order should remain logical and preserve meaning and operation. [S2] The guidance does not prescribe a particular single-page route-change target or require focus to move to a heading.

Follow-up question

How do headings and the browser tab title fit into that plan? Should I update both every time?

Geez

Use a meaningful main heading to identify the newly displayed view, and make sure it is easy to find when someone reads or navigates the content. If your chosen focus target is that heading, verify that it actually receives focus after the view has rendered; merely displaying a heading does not show that focus was moved there.

Also update the document title when the displayed route changes, using a concise title that describes that view. MDN explains that accurate, concise, unique document titles help assistive-technology users infer a page’s purpose without first navigating its contents, and notes that significant page-state changes can be reflected in the title. [S1] A changed title supports orientation, but the cited guidance does not establish that it replaces focus management or specify an exact title format.

Follow-up question

What would a concrete route-change plan look like for a site with a Home view and a Help view?

Geez

Assuming these are two distinct views reached through in-app navigation, write down the expected result before implementing it:

  1. The user activates the Help link from Home.
  2. The Help view appears, with a clear main heading such as “Help.”
  3. The document title changes to a title describing Help.
  4. Focus moves to the Help heading, or to another intentionally chosen target at the beginning of the view.
  5. Pressing Tab continues through Help content and controls in a sensible order.

If the change is only a small update within Home, decide whether retaining focus on the initiating control better preserves the user’s place. Check that the resulting view’s heading, title, and focus behavior agree. The title and logical-order points follow the cited MDN guidance; the specific sequence and target above are an illustrative plan, not a source-mandated implementation.

Follow-up question

How should I test it, including someone opening the Help route directly instead of clicking a link?

Geez

Test both paths separately: navigate to Help from within the site, then load the Help route directly. For each path, use only the keyboard: activate the navigation control when applicable, note where focus ends up, and press Tab repeatedly to see whether focus proceeds through the new view in a meaningful order. Confirm that the visible main heading and document title identify the view. If direct loading produces different focus behavior, decide what starting position is least confusing and test that case too.

Keep a short record of the expected and observed results for each route. These checks help reveal problems in your implementation, but the cited guidance does not establish a complete conformance test or guarantee accessibility. If behavior varies across browsers or assistive technologies, investigate it in your project’s actual supported environments rather than assuming one check covers all users.

A practical checklist

  • Classify each view change as a substantial route change or a small update.

  • Choose and document the intended focus target, or explicitly decide to retain focus.

  • Give each view a clear main heading and update the document title for significant changes.

  • Check keyboard focus order after in-app navigation and after directly loading a route.

  • Record expected and observed focus, heading, title, and Tab sequence for each test path.

A few more useful answers

Should every route change move focus to the main heading?

Not necessarily. Consider that for a substantial view change, but assess small updates separately so a user is not moved unnecessarily. The cited guidance does not prescribe a universal focus target.

Does changing the document title make focus management unnecessary?

No. A descriptive title can help identify the view, while focus behavior and keyboard order still need their own deliberate plan and checks.

Is testing a route only by clicking an in-app link enough?

No. Include direct loading as a separate test path. Check the heading, title, focus position, and subsequent Tab order.

Sources

References used for this guide.

  1. [S1] MDN: The HTML title element and accessibility
    developer.mozilla.org · Checked
  2. [S2] MDN: Operable accessibility guidance
    developer.mozilla.org · Checked

YOUR QUESTION. YOUR DETAILS.

Let’s work through your situation.

Get a tailored answer or help with your next task. Starts at $1, with a quote before you pay.

Ask your own question
← Back to Geez at Work