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

NavLink activeClassName appears before className #5107

Closed
carloluis opened this issue May 12, 2017 · 3 comments
Closed

NavLink activeClassName appears before className #5107

carloluis opened this issue May 12, 2017 · 3 comments

Comments

@carloluis
Copy link
Contributor

Version

4.1.1

Test Case

https://codepen.io/carloluis/pen/gWzPzd

Steps to reproduce

  • have at least two routes
  • set up a nav-bar with
    • normal and active classes have at least one property in common

Expected Behavior

active navigation link should have set all the active class properties

Actual Behavior

common properties are resolved with normal class values

  • correct order to apply classes in should be:
    • first className, then activeClassName
<Link
          className={ isActive ? [ className, activeClassName ].filter(i => i).join(' ') : className }
          style={isActive ? { ...style, ...activeStyle } : style}
          {...rest}
        />
  • actual code returned from NavLink component
<Link
          to={to}
          className={isActive ? [ activeClassName, className ].filter(i => i).join(' ') : className}
          style={isActive ? { ...style, ...activeStyle } : style}
          {...rest}
        />
@timdorr
Copy link
Member

timdorr commented May 12, 2017

Could you submit a PR to change this?

@carloluis
Copy link
Contributor Author

carloluis commented May 12, 2017

Yes (#5109)

@carloluis
Copy link
Contributor Author

No mistake. The correct title for this issue would be: NavLink activeClassName appears before className.
So, I'll change the title. The PR still open in case you want to merge and set the active-class-name to the end (which corresponds with the right order in which default and active classes must be declare in css)

@carloluis carloluis changed the title NavLink activeClassName has less priority than className NavLink activeClassName appears before className May 12, 2017
@timdorr timdorr closed this as completed May 12, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants