Skip to content

Styled.a vs Link for active class #376

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

Closed
rjmoggach opened this issue Sep 19, 2019 · 2 comments · Fixed by #377
Closed

Styled.a vs Link for active class #376

rjmoggach opened this issue Sep 19, 2019 · 2 comments · Fixed by #377
Labels
bug Something isn't working

Comments

@rjmoggach
Copy link
Contributor

I'm trying to style active menu items and running into an issue with Styled.a vs Link in gatsby.

const MenuItem = props => {
    return <Styled.a as={Link} sx={{ variant: 'text.menu' }} {...props} activeClassName='active' />
}

returns a link tag with aria-current="page" and no active class. I've tried styling using

'[aria-current]:not([aria-current="false"])': {
            color: '#fff',
        },

but that's not working...

The following works but doesn't allow for using the Styled.a pattern which is sooo nice.

const MenuItemOld = props => {
    return <Link sx={{ variant: 'text.menu' }} {...props} activeClassName='active' />
}
@jxnblk
Copy link
Member

jxnblk commented Sep 19, 2019

Hmm. <Styled.a as={Link} activeClassName='active' /> should work so this might be a bug. Does the active class name not render at all?

@rjmoggach
Copy link
Contributor Author

Correct. no active class is rendered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants