Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RouterLink isActive class not working when adding custom class attr. #133

Closed
wietseva opened this issue Mar 12, 2020 · 1 comment
Closed
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@wietseva
Copy link
Contributor

When a route is active, RouterLink currently does not add router-link-active class when a custom class attribute is provided.

Using JSX

<Link class="nav-item" to="route" /> 

renders

<a class="nav-item" href="/route" />

expected would be

<a class="nav-item router-link-active" href="/route" />
@posva posva added bug Something isn't working good first issue Good for newcomers labels Mar 12, 2020
@wietseva
Copy link
Contributor Author

Simply moving the the ...attrs spread to the top seems to fix this issue.

 return h(
        'a',
        {
          ...attrs,
          class: elClass.value,
          onClick: link.navigate,
          href: link.href,
        },
        slots.default && slots.default(link)
      )

#134

@posva posva closed this as completed in 392c295 Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants