FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(navigation): stop the locale root marking every page as current by TheMeinerLP · Pull Request #274 · OneLiteFeatherNET/launchpad · GitHub

fix(navigation): stop the locale root marking every page as current - #274

Merged
TheMeinerLP merged 2 commits into
mainfrom
fix/nav-active-prefix
Aug 4, 2026
Merged

TheMeinerLP merged 2 commits into
mainfrom
fix/nav-active-prefix

Conversation

Copy link
Copy Markdown
Collaborator

Two nav items were highlighted at once on every subpage — reported from the Team page, where both "Übersicht" and "Team" were lit.

Cause

route.path === props.path || route.path.startsWith(props.path + '/')

The prefix half is what keeps a section link current on its own subpages — /de/team staying lit on /de/team/someone. But the home link's path is the locale root, and /de is a prefix of everything under it. So "Übersicht" was current on Team, Blog, Community-POIs and the rest.

Measured on /de/team before the fix:

<a href="/de"      aria-current="page">
<a href="/de/team" aria-current="page">

aria-current is the part that matters beyond the highlight — a screen reader announced two different links as the current page, which is a false statement about where the user is, not a styling nit.

Not a regression from the audit work

Worth stating, since that was the initial suspicion. The rule dates to f86f20b (#40); git log -S finds no other commit touching it. My #237 edited this file but only swapped variant from a frozen constant to withDefaults.

Checked rather than argued: at 7f0f2a6^ — the commit immediately before #237 — /de/team already served both links with aria-current="page".

Fix

Depth, not a hardcoded home path: a link matches by prefix only when it has a segment of its own below the locale root. Extracted to utils/navigation.ts so it can be tested without a runtime.

After, across six routes:

/de                   → /de
/de/team              → /de/team
/de/blog              → /de/blog
/de/community-poi     → /de/community-poi
/en/blog              → /en/blog
/de/team/themeinerlp  → /de/team      ← prefix matching still works

One thing that looks wrong in that output and is not

/de/blog also reports a second aria-current="page". It is the footer's blog link, and the attribute comes from Vue Router itself (router-link-exact-active), not from this component — a link that genuinely points at the current page. Inside the navigation, exactly one item is current.

The guard

The pure function is covered in both directions: exact match, section-with-subpage, locale root against every page, and a sibling that merely shares a prefix (/de/teams must not light /de/team — the old rule got that right too, via the trailing slash, and the new one keeps it).

One test holds the old implementation verbatim and asserts the two now disagree. Without it the suite would pass just as happily against the buggy version and prove nothing.

Gates

Suite: 154 tests, 50 files. Build green. Ratchet unchanged at 319 / 36 / 21.

🤖 Generated with Claude Code

https://claude.ai/code/session_017uWFJwn6dswmNtR8kKB86s

Red on the wiring: NavigationItem still prefix-matches props.path, so
/de is current on every subpage.

Refs: nav double-active
TheMeinerLP merged commit 3fedf6b into main Aug 4, 2026
7 checks passed
TheMeinerLP deleted the fix/nav-active-prefix branch August 8, 2026 09:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL