TanStack Router 1.170.46: navigating to /settings/privacy marks both /settings and /settings/privacy links as aria-current="page"
Comments · 0
Be the first to comment.
Bug reportby SceneRecap AI
Repro steps
- 1.Open the test page. It loads on the Home route with Home page content.
- 2.Click the link Settings. The Settings overview loads and the badge reports 1 element with aria-current="page": /settings.
- 3.Click the link Settings / Privacy.
- 4.Observe that both Settings and Settings / Privacy are highlighted and the badge reports 2 elements with aria-current="page".
- 5.Click the link Settings / Security.
- 6.Observe that both Settings and Settings / Security are highlighted and the badge reports 2 elements with aria-current="page".
Expected
Only the link that matches the current location should carry aria-current="page". On /settings/privacy only the Settings / Privacy link should have it. On /settings/security only the Settings / Security link should have it. The parent Settings link may be styled active, but it should not be announced as the current page.
Actual
On /settings/privacy both the /settings and /settings/privacy links carry aria-current="page" at the same time. On /settings/security both the /settings and /settings/security links carry it. The status badge turns red and reports 2 elements.
Evidence
Issue markdown (copy-paste ready)
## Summary In `@tanstack/react-router@1.170.46` with default `activeOptions.exact: false`, navigating to a nested route sets `aria-current="page"` on both the parent link (`/settings`) and the child link (`/settings/privacy` or `/settings/security`). Only one element should represent the current page. Related issue: #8979. ## Environment - Chromium 151.0.7922.34, macOS - Viewport 1280x720, DPR 1 - `@tanstack/react-router@1.170.46` via esm.sh - Default `activeOptions.exact: false` ## Steps to reproduce 1. Open the test page. It loads on Home (1.0s). 2. Click **Settings** (7.66s). The badge shows `1 element with aria-current="page": /settings` (9.0s). This control case works. 3. Click **Settings / Privacy** (12.58s). 4. Observe the badge and the link highlights (15.0s). 5. Click **Settings / Security** (19.09s). 6. Observe the badge and the link highlights (21.0s). ## Expected Only the link that exactly matches the current location has `aria-current="page"`. On `/settings/privacy` that is Settings / Privacy only. On `/settings/security` that is Settings / Security only. The parent link can keep active styling without being announced as the current page. ## Actual - At 15.0s the badge reads `2 elements with aria-current="page": /settings and /settings/privacy`. Both links are highlighted. - At 21.0s the badge reads `2 elements with aria-current="page": /settings and /settings/security`. Both links are highlighted. - The state persists (19.0s, 23.0s). ## Control On `/settings` alone (9.0s) exactly one element has `aria-current="page"`. This is correct. ## Side observation At 1.0s on Home, the Home link looks highlighted but the badge reports 0 elements with `aria-current="page"`. It may be worth checking, but it is separate from this report. ## Impact Screen reader users hear two links announced as the current page in nested navigation. This breaks the meaning of `aria-current="page"`. ## Suggested area Link active state logic. The fuzzy match (`exact: false`) seems to also drive `aria-current="page"`. `aria-current="page"` should likely require an exact location match. *Recorded with SceneRecap.*
This report was written by SceneRecap from a screen recording. Try SceneRecap free
Turn a screen recording into a bug report like this one.
Repro steps, expected vs actual and the console and network evidence, each with a timestamp. On every plan, Free included.
Try SceneRecap free →