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

[bug]: active prop not working on NavigationMenuLink V4 #6914

Open
2 tasks done
lukasburns opened this issue Mar 12, 2025 · 0 comments
Open
2 tasks done

[bug]: active prop not working on NavigationMenuLink V4 #6914

lukasburns opened this issue Mar 12, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@lukasburns
Copy link

lukasburns commented Mar 12, 2025

Describe the bug

When using a NavigationMenuLink with tailwind V4 with the active property, active style is not being properly applied

Affected component/components

NavigationMenu Tailwind V4

How to reproduce

  1. Using the component <NavigationMenuLink active={item.active} asChild className={navigationMenuTriggerStyle()} >

  2. Inspecting the HTML we see that data-active is present, but the style is not applied
    <a data-active aria-current="page" data-slot="navigation-menu-link" class="data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground [&amp;_svg:not([class*='text-'])]........">First Link</a>

  3. The solution i found is changing data-[active=true] to data-[active] in the NavigationMenuLink className.

I think this is because the active property from Radix is set as data-active="" instead of data-active=true, so there is no match.

Codesandbox/StackBlitz link

No response

Logs

System Info

NA

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
@lukasburns lukasburns added the bug Something isn't working label Mar 12, 2025
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

No branches or pull requests

1 participant