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

Đang mở
#746 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@clean99 đang làm issue này rồi.

Từ ngày 22/11/2026.

  • #747 của @clean99 — đang mở
  • #749 của @junaidkhan80121 — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
frontend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
1.3k
Fork
193
Merge trung bình
8 giờ 48 phút
Pull request đã merge (30 ngày)
21

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của solidjs/solid-router

Tất cả issue của solidjs/solid-router

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.