Repository navigation
Description
Summary
Vike Client Routing swaps the page under <main> while the chrome persists, and nothing tells the visitor it happened: focus is never moved and the new title is never announced. The two hooks that are the natural home for the fix — pages/+onPageTransitionStart.ts and pages/+onPageTransitionEnd.ts — currently do nothing but write four console.log lines per navigation and toggle a page-transition body class that no stylesheet in the repo uses.
Raised by the Wednesday analysis survey (ISO week 36, angle: accessibility).
What the visitor actually experiences
| Where the link was | What happens to focus |
|---|---|
| In the header (persists across the swap) | Focus stays on that link. Tabbing forward walks the rest of the nav, not the new content |
In the page body — a ContentCard, a TableOfContents entry, a breadcrumb |
The element is removed, so focus falls back to <body>. The next Tab starts from the top of the document |
In both cases document.title changes silently. A screen-reader user gets no signal at all that the page changed.
The announcement half is a WCAG 2.1 4.1.3 Status Messages (AA) gap, which docs/rules/design-system.md makes non-optional. The focus half is not a numbered failure on its own — it is the standard remedy that makes the announcement useful.
Approach
layouts/LayoutRoot.tsx— render one persistent polite announcer beside the Sentry boundary, so bare embed routes get it too:
<div aria-live="polite" aria-atomic="true" className="sr-only" id="route-announcer" />layouts/LayoutChrome.tsx:139andlayouts/LayoutMap.tsx:57— give each<main>id="main-content"andtabIndex={-1}so it can receive programmatic focus without entering the tab order.pages/+onPageTransitionEnd.ts— writedocument.titleinto#route-announcer, thendocument.getElementById('main-content')?.focus({ preventScroll: true }). Skip the focus move whenpageContext.isBackwardNavigationis true: back/forward should restore the previous scroll position, not steal focus. Keep announcing in that case.- Both hooks — delete the four
console.logcalls. Either style.page-transitionor drop the class; right now it is added and removed for nothing.
Acceptance criteria
- After an in-site navigation, focus is on
<main>and the next Tab enters the new page's content. - After an in-site navigation, a polite live region carries the new
document.title. - A back/forward navigation announces but does not move focus, and scroll position is unchanged from today's behaviour.
- No
console.logremains in either transition hook. -
page-transitionis either styled or removed — it is not added to the DOM unused.
Verification checklist
-
pnpm dev, then from/click a header nav link and aContentCardlink in turn; after each, press Tab once and confirm the focused element is inside the new page rather than in the header. - With VoiceOver (or NVDA) running, perform the same two navigations and confirm the new page title is spoken each time.
- Navigate forward twice, then press Back; confirm the title is spoken and the scroll position is restored.
-
grep -rn "console.log" pages/+onPageTransition*.tsreturns nothing. -
pnpm lint && pnpm typecheck && pnpm test:runpass.
Notes
- Not a duplicate:
search_issuesoverrepo:sydevs/WeMeditateWebforaccessibilityand forpage transition focus management client-side navigation announce route changereturns nothing open (the only hit, feat(preview): block link navigation in live-preview routes #46, is closed and about blocking navigation in preview routes). - Evidence that the class is dead:
grep -rn "page-transition" .(excludingnode_modulesand.git) matches only the two hook files; the repo's four stylesheets arecomponents/organisms/SubtleSystem/SubtleSystem.css,layouts/style.css,layouts/tailwind.css,layouts/fonts.css. - Optional, same two lines of change: once
<main>has an id, a skip link inLayoutChromeis a one-line addition. It is not a 2.4.1 conformance failure today — the page has<header>/<nav>/<main>/<footer>landmarks, which W3C technique ARIA11 accepts as sufficient — but it is the cheap win for keyboard users who have to pass the same header nav on every page. Fold it in or leave it; say which.
🤖 Written by the sydevs autonomous loop — see what this is
Metadata
Metadata
Assignees
Labels
Type
Fields
Hold Until
Priority
Activity