Next.js App Router skips keyboard focus on navigation, but a simple fix exists
The Next.js App Router includes a built-in route announcer that notifies screen readers of page changes via an aria-live region, but it does not reset keyboard focus after client-side navigation. When a user activates a link, the element unmounts and focus falls back to the document body, forcing keyboard users to tab through the entire header again on every route change. A 15-line client component using usePathname() and tabIndex={-1} can restore focus to the new page content, resolving the issue. The author discovered the bug through hands-on keyboard-only testing rather than automated audits. The fix has added urgency for many products since the European Accessibility Act became enforceable on 28 June 2025.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in