[2.0.1] hashHistory: link claims and useLinkState ignore the hash, so aria-current/data-active are wrong on every link

Offen
#746 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@clean99 arbeitet bereits daran.

Seit 22.11.2026.

  • #747 von @clean99 — offen
  • #749 von @junaidkhan80121 — offen

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
72/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
typescript
Bereich
frontend

Rechercherichtung

Start by tracing how hashHistory() represents the current location and how link claims and useLinkState compare it with paths nodes and string URLs. The report includes a reproduction app, so use it to check / and /applications in hash mode, then compare with browserHistory(). Done means only the link for the current page receives aria-current="page" and data-active in both routes.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Describe the bug

With hashHistory(), the router puts aria-current="page" and data-active on the wrong links.

In hash mode, links built with paths render as #/ and #/applications:

  • On /#/, both links are marked as current and active.
  • On /#/applications, neither link is marked.

What works correctly:

  • Navigation: clicking the links goes to the right page.
  • The same app with browserHistory(): only the current page's link is marked.
  • useLinkState given a paths node. Given the plain string "#/applications", it is wrong too (inverted).

Versions: @solidjs/router 2.0.1 (also 2.0.0 and current main), solid-js 2.0.3, @solidjs/web 2.0.3, @solidjs/vite-plugin 3.0.1, vite 8.3.8.

Your Example Website or App

https://github.com/hapreanmanuel/solid-router-hashhistory-link-state-bug

Steps to Reproduce the Bug or Issue
  1. Open the app on /#/ (Home). Both links are highlighted: <a href="#/"> and <a href="#/applications"> both have aria-current="page" and data-active.
  2. Click "Applications". The Applications page renders, but neither link has aria-current or data-active.
  3. Reload the page on /#/applications. Still neither link.
Expected behavior

Only the link to the current page is marked, like with browserHistory():

  • On /#/, only Home has aria-current="page" and data-active.
  • On /#/applications, only Applications does.
Screenshots or Videos

No response

Platform
  • OS: Windows 11
  • Browser: Chrome, reproduced in Chromium 156
  • Version: @solidjs/router 2.0.1
Additional context

Claude Code has helped me discover this bug, as well as building the sample to showcase it and report it.

I did my best to understand and check it myself before reporting it, as well as searching the active submitted issues for it, without finding any match.

Vorherrschende Sprache
TypeScript
Sterne
1.3k
Forks
193
Ø Merge
8 Std. 48 Min.
Gemergte PRs (30 T.)
21

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus solidjs/solid-router

Alle Issues in solidjs/solid-router

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.