How to set 'active' state on NavigationMenuLink when using client side routing #1539
Unanswered
benkroeger
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The documentation recommends to wrap
RouterLink
insideNavigationMenuLink
like so:but that doesn't allow to read the
isActive
slot prop fromRouterLink
and pass it to theNavigationMenuLink
in order to get thearia-current
anddata-active
attributes set correctly.normally,
RouterLink
would set thearia-current
correctly - but due to attribute inheritance fromNavigationMenuLink
'sPrimitive
, this gets overwritten withundefined
I am currently using something along the lines of
since this takes away the possibility to work with
RouterLink
'sactive-class
attribute - and is overall a lot more verbose - I was wondering if there might be a better way.Beta Was this translation helpful? Give feedback.
All reactions