You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Using the component <NavigationMenuLink active={item.active} asChild className={navigationMenuTriggerStyle()} >
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 [&_svg:not([class*='text-'])]........">First Link</a>
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
The text was updated successfully, but these errors were encountered:
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
Using the component
<NavigationMenuLink active={item.active} asChild className={navigationMenuTriggerStyle()} >
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 [&_svg:not([class*='text-'])]........">First Link</a>
The solution i found is changing
data-[active=true]
todata-[active]
in the NavigationMenuLink className.I think this is because the active property from Radix is set as
data-active=""
instead ofdata-active=true
, so there is no match.Codesandbox/StackBlitz link
No response
Logs
System Info
Before submitting
The text was updated successfully, but these errors were encountered: