Skip to content

fix: active links consider query params and respect existing aria-current#3755

Merged
bartlomieju merged 4 commits intomainfrom
fix/active-links-query-params
Apr 9, 2026
Merged

fix: active links consider query params and respect existing aria-current#3755
bartlomieju merged 4 commits intomainfrom
fix/active-links-query-params

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

Summary

  • matchesUrl() now considers query parameters — links with query params that don't match the current URL get Ancestor instead of Current status
  • Links with a user-set aria-current attribute are left untouched (both server and client side), fixing daisyUI tab components and similar use cases
  • Client-side updateLinks() passes search params and respects user-set attributes

Closes #3474

Test plan

  • Existing active links tests pass (2/2)
  • Verify tabs with ?sort=name and ?sort=price on the same pathname are not both marked as current
  • Verify manually-set aria-current on an anchor is preserved

🤖 Generated with Claude Code

bartlomieju and others added 4 commits April 8, 2026 19:32
…rent (#3474)

- matchesUrl() now accepts an optional currentSearch parameter; when a
  link's href contains query params that don't match the current page,
  it returns Ancestor instead of Current
- setActiveUrl() skips links that already have a user-set aria-current
  attribute, allowing frameworks like daisyUI to manage tabs
- Client-side updateLinks() also respects user-set aria-current

Closes #3474

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bartlomieju bartlomieju merged commit fc0ff66 into main Apr 9, 2026
8 of 9 checks passed
@bartlomieju bartlomieju deleted the fix/active-links-query-params branch April 9, 2026 07:42
@bartlomieju bartlomieju restored the fix/active-links-query-params branch April 9, 2026 07:42
@bartlomieju bartlomieju deleted the fix/active-links-query-params branch April 9, 2026 07:42
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.

Can we disable setActiveLinks on anchor element with href, or don't modify the aria-current if it's already set?

1 participant