Repository navigation
Description
Environment
@nuxt/ui4.10.0- Vue + Vite (no Nuxt), Inertia.js v2, plugin configured as
ui({ router: 'inertia' }) - File under discussion:
dist/runtime/vue/overrides/inertia/Link.vue - Comparison point:
dist/runtime/vue/overrides/vue-router/Link.vue
Description
The router: 'inertia' Link override diverges from the vue-router one in three ways. Because every Nuxt UI component that renders a link (UButton, UBreadcrumb, UNavigationMenu, UDropdownMenu, …) goes through this component, all three affect the whole library in Inertia mode.
1. aria-current is never emitted
isLinkActive (inertia/Link.vue:109-123) only feeds linkClass (:124-130) and the active slot prop. The rendered anchor never receives aria-current.
The vue-router variant does emit it (vue-router/Link.vue:119 and :136):
...exact && isExactActive ? { 'aria-current': props.ariaCurrentValue } : {},The Inertia variant has no equivalent, so an Inertia app that migrates its navigation onto Nuxt UI silently loses the current-page announcement for screen-reader users.
2. ariaCurrentValue leaks onto the DOM as an invalid attribute
ariaCurrentValue is declared with a default (inertia/Link.vue:26):
ariaCurrentValue: { type: String, required: false, default: "page" },but it is not in the reactiveOmit list at :71:
const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class", "target", "rel", "noRel"));so useForwardProps passes it to ULinkBase (:150-166), which does not declare it either, so it lands in $attrs and reaches the DOM as ariacurrentvalue="page".
vue-router/Link.vue omits it from its reactiveOmit list too, but there it is harmless: RouterLink declares ariaCurrentValue as a real prop and consumes it. inertia/LinkBase.vue (and @inertiajs/vue3's Link) declare no such prop.
Because the prop carries a default, the attribute appears even on components that render no link at all. Measured on a page with three Nuxt UI components — one <UButton to> and two <UButton> with no to — all three rendered ariacurrentvalue="page", client-side and in SSR output.
Minimal repro:
<UButton>no link at all</UButton>
<!-- renders: <button ... ariacurrentvalue="page"> -->3. Active matching uses a raw prefix against a query-carrying URL
inertia/Link.vue:119:
if (!props.exact && page.url.startsWith(href.value)) {
return true;
}usePage().url in Inertia includes the query string, and startsWith is a raw prefix test. Three consequences:
- A query string defeats the match.
page.url = '/inventory?search=x'withto="/inventory"is active (prefix holds), butto="/inventory"onpage.url = '/inventory?search=x'where the link itself carries a query — or any link whose href is longer than the bare path — is not. More importantly the reverse case,to="/inventory/adjust"while on/inventory?tab=1, behaves unpredictably. to="/"is active on every page, since every URL starts with/.- Segment boundaries are ignored:
to="/inventory"reports active on/inventory-adjustments.
The vue-router variant delegates this to RouterLink's isActive/isExactActive, which are path- and segment-aware, so the Inertia variant is the odd one out.
Suggested fix
- Add
...isLinkActive ? { 'aria-current': props.ariaCurrentValue } : {}to the twov-bindobjects ininertia/Link.vue's template (absent, not"false", when inactive). - Add
"ariaCurrentValue"to thereactiveOmitlist at:71. - Compare on the path only, with segment boundaries:
const pathOf = (url) => {
const path = url.split('#')[0].split('?')[0]
return path.length > 1 && path.endsWith('/') ? path.slice(0, -1) : path || '/'
}
// non-exact
const current = pathOf(page.url)
const target = pathOf(href.value)
return target === '/' ? current === '/' : current === target || current.startsWith(`${target}/`)Happy to open a PR for this if the approach looks right.
Additional context
We are carrying this as a local build-time patch on the vendored module while migrating a production Inertia app onto Nuxt UI, and would rather drop it than maintain it.
Activity
coderabbitai commentedon Aug 6, 2026
🔗 Related PRs
#6628 - fix(components): forward
$attrsto root element whentoprop is absent [merged]#6637 - fix(Link): fall back to original path when
localePathfails [merged]#6640 - fix(ContentNavigation): key items by identity to prevent leading icon flash [merged]
#6668 - fix(Button): allow inline event handlers with non-void return types [merged]
#6677 - fix(Link): apply
relprop to internal links [merged]📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
kodjosama commentedon Aug 7, 2026
Opened #6809 with a fix for all three points, plus the missing test harness — the
vuevitest project resolves#componentsto the vue-router overrides only, so theinertiadirectory was never loaded by any test. That's presumably how the three defects coexisted.One correction to my own report: I listed
to="/"being active everywhere as a defect. With segment-aware matching that's just/being a parent of every route, which is whatRouterLinkdoes too — so the PR keeps that behaviour andexactstays the way to make a home link exclusive. The real defect there was the segment-blindness (/inventorymatching/inventory-adjustments), which is fixed.For
aria-currentthe PR mirrors the vue-router condition exactly (exact && isExactActive) rather than introducing a different policy for Inertia, since parity is the point of this report. If you'd rather emit it on exact-active regardless of theexactprop, that looks like a change for both variants together and I'm happy to follow up.fix(vue): match active links on path segments
chore(playground): add sibling pages whose slugs share a prefix
chore(playground): add sibling pages whose slugs share a prefix (#49)
fix(vue): match active links on path segments (#35)