Repository navigation
fix(A): set aria-current only when the query matches too - #722
Merged
Merged
Conversation
Filter links like /?tag=a and /?tag=b were all marked aria-current="page" because only the pathname was compared. The current-page state now also requires the link's search params to match the location's, ignoring order, the same rule 2.0 uses. The active class keeps matching on the path. Fixes #518 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWPn7eCrWhevqJzoZeX
🦋 Changeset detectedLatest commit: 18991b8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
1 of 2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Ryan · project thread
Fixes #518.
Problem
<A>setaria-current="page"whenever the link's pathname matched the location's. The link's query was removed before the comparison, so filter links like/?tag=a,/?tag=band/?tag=cwere all marked as the current page at once.Change
The current-page check now also requires the link's search params to equal the location's, ignoring parameter order and the hash. This is the same rule 2.0 uses for
currentandaria-current(linkMatcheronnext). The active and inactive classes still match on the path only, so existing styling is unchanged.This replaces #720: it fixes the wrong
aria-currentwith no newactiveOptionsAPI, and it matches what 2.0 does.Tests
There's a new case in
test/anchor.spec.tsxthat fails without the fix.pnpm testpasses, including the SSR and type suites. The changeset is a patch.Generated by Claude Code