Title: `Link`: mark the link to the current page (`aria-current`, `data-active`) · Issue #676 · voidzero-dev/void · GitHub
Open Graph Title: `Link`: mark the link to the current page (`aria-current`, `data-active`) · Issue #676 · voidzero-dev/void
X Title: `Link`: mark the link to the current page (`aria-current`, `data-active`) · Issue #676 · voidzero-dev/void
Description: Summary Link renders a plain with no sign that it points to the current page. Every navigation menu (a header, a sidebar, tabs) has to compare useRouter().path with each link's href by hand. Those hand-written checks usually style th...
Open Graph Description: Summary Link renders a plain with no sign that it points to the current page. Every navigation menu (a header, a sidebar, tabs) has to compare useRouter().path with each link's href by hand. Th...
X Description: Summary Link renders a plain <a> with no sign that it points to the current page. Every navigation menu (a header, a sidebar, tabs) has to compare useRouter().path with each link's href b...
Opengraph URL: https://github.com/voidzero-dev/void/issues/676
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`Link`: mark the link to the current page (`aria-current`, `data-active`)","articleBody":"### Summary\n\n`Link` renders a plain `\u003ca>` with no sign that it points to the current page. Every navigation menu (a header, a sidebar, tabs) has to compare `useRouter().path` with each link's `href` by hand. Those hand-written checks usually style the active link but forget `aria-current=\"page\"`, so screen readers aren't told which link is the current page.\n\n### Example\n\nWhat an app writes today:\n\n```tsx\nimport { Link, useRouter } from '@void/react';\n\n// The section's home link only matches itself; the others also match their nested pages.\nfunction isActive(path: string, href: string, home: string) {\n return path === href || (href !== home && path.startsWith(`${href}/`));\n}\n\nfunction Sidebar({ links, home }: { links: { href: string; label: string }[]; home: string }) {\n const { path } = useRouter();\n return links.map((link) => {\n const active = isActive(path, link.href, home);\n return (\n \u003cLink\n key={link.href}\n href={link.href}\n data-active={active || undefined}\n aria-current={active ? 'page' : undefined}\n >\n {link.label}\n \u003c/Link>\n );\n });\n}\n```\n\nWhat it could be:\n\n```tsx\n\u003cLink href=\"/admin\">Overview\u003c/Link>\n\u003cLink href=\"/admin/users\" activeMatch=\"prefix\">Users\u003c/Link>\n```\n\n### Proposal\n\n- **`aria-current=\"page\"`** when the link's path is the current path. It's semantically \"this is the current page\", so exact match only.\n- **`data-active`** on the same link, for styling with `[data-active]` or Tailwind's `data-active:`. Unlike a class, it doesn't collide with the app's own `className`.\n- **An opt-in for nested pages**, for example `activeMatch=\"prefix\"`, so `/admin/users` stays highlighted on `/admin/users/42`. It matches whole path segments, so `/admin/users` doesn't match `/admin/users-archive`.\n- **Ignore the query and hash** when matching, so `/inbox?page=2` still marks `/inbox`.\n\nThe names are only suggestions. The router already holds the current path in every adapter, so this should look the same in React, Vue, Svelte and Solid. #672, which moves the shared `Link` logic into `void/pages-client`, looks like the natural place for the matching.\n\n### Prior art\n\n- **React Router:** `NavLink` sets `aria-current=\"page\"` and an `active` class, and takes `end` to choose between exact and nested matching.\n- **TanStack Router:** `Link` sets `aria-current=\"page\"` and `data-status=\"active\"`, and takes `activeOptions: { exact, includeSearch }` and `activeProps`.\n- **Vue Router:** `RouterLink` adds `router-link-active` for nested matches, and `router-link-exact-active` plus `aria-current=\"page\"` for exact ones.\n- **Nuxt:** `NuxtLink` takes `activeClass` and `exactActiveClass`.\n\n### Environment\n\n- `void` 1.5.0\n- `@void/react` 1.5.0\n","author":{"url":"https://github.com/karthickeyan-dev","@type":"Person","name":"karthickeyan-dev"},"datePublished":"2026-11-02T14:31:35Z","url":"https://github.com/voidzero-dev/void/issues/676"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f154c94d-171e-d794-ce75-5efc52779cd5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B030:25245F:1A99626:242436C:6AFB8E45 |
| html-safe-nonce | f5e1fbf4da94dd5c3cda04a5959d291837502a589ba2a636c159590993583864 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDMwOjI1MjQ1RjoxQTk5NjI2OjI0MjQzNkM6NkFGQjhFNDUiLCJ2aXNpdG9yX2lkIjoiODQ5NDA0NzI4ODU0MzEyMDk2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 40d532d01645714f97c6a52a69f3db9eda59e5b1d3395c830c50e0cab2f14df6 |
| hovercard-subject-tag | issue:6164568644 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/voidzero-dev/void/676/issue_layout |
| twitter:image | https://opengraph.githubassets.com/504b85cb8cb6156a5c920a1ae88b5cfc37be85d8e113f55a6d25996df6019ca3/voidzero-dev/void/issues/676 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/504b85cb8cb6156a5c920a1ae88b5cfc37be85d8e113f55a6d25996df6019ca3/voidzero-dev/void/issues/676 |
| og:image:alt | Summary Link renders a plain with no sign that it points to the current page. Every navigation menu (a header, a sidebar, tabs) has to compare useRouter().path with each link's href by hand. Th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | karthickeyan-dev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9694464143465782ecae2a97650b2a2b0708d5c31c74f41ee86da57e315e2735 |
| turbo-cache-control | no-preview |
| go-import | github.com/voidzero-dev/void git https://github.com/voidzero-dev/void.git |
| octolytics-dimension-user_id | 149750581 |
| octolytics-dimension-user_login | voidzero-dev |
| octolytics-dimension-repository_id | 1164437080 |
| octolytics-dimension-repository_nwo | voidzero-dev/void |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1164437080 |
| octolytics-dimension-repository_network_root_nwo | voidzero-dev/void |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 05d967182208691fc7f2e6af52e82fa7fabf6bd5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width