solid-router icon indicating copy to clipboard operation
solid-router copied to clipboard

`<A>` link detects incorrect active state when `href` has a trailing slash

Open amirhhashemi opened this issue 7 months ago • 0 comments

Describe the bug

Consider this link:

<A href="/solid-router/">Click</A>

When I'm on the /solid-router/ route, this link is correctly considered active. However, when I navigate to the /solid-router/route route, the same link is not active.

I've traced this behavior to this line of code. It appears that a trailing slash is added to the href before comparison, regardless of whether the href already includes one.

If this behavior is intentional, it should be clarified in the documentation. The current documentation suggests that Solid Router simply checks whether the current location starts with the href. I'm happy to update the documentation to reflect this if confirmed.

Your Example Website or App

...

Steps to Reproduce the Bug or Issue

...

Expected behavior

...

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

amirhhashemi avatar Jul 03 '25 15:07 amirhhashemi