Skip to content

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

@amirhhashemi

Description

@amirhhashemi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions