solidjs / solidjs/solid-router

`A` active does not account for search params

Open
#518 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
1.3k
Forks
180
Avg merge
1d 13h
Merged PRs (30d)
19

Description

Describe the bug

A list of links that are used for filtering content will result in all of them having an active class and all of them having aria-current="page"

<A href="/?example=1">1</A>
<A href="/?example=2">2</A>
<A href="/?example=3">3</A>

The problem is that all 3 links cannot be active here at the same time and aria-current fails to differentiate this difference. The workaround here would be to build a custom A that also takes into account the search params.

Your Example Website or App

https://stackblitz.com/edit/solidjs-templates-hhpgedwq?file=src%2FApp.tsx

Steps to Reproduce the Bug or Issue
  1. Create multiple links that update search params
  2. See all are considered active and all have an invalid aria-current
Expected behavior

Some way to force active to account for the search params

Screenshots or Videos

No response

Platform
  • OS: macOS
  • Browser: Chrome
  • Version: 132
Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in the linked StackBlitz example with several links that differ only by search parameters. Inspect the router's active-link and aria-current behavior; done means links with different query values are not all marked active or aria-current="page".

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.