Is it possible to manually manage the state of NavigationMenuTrigger?
#892
Unanswered
feryardiant
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I'm new to radix-vue, just messing around with it for couple days on my existing project. Came across an issue where I need to gain more control of the state of
NavigationMenuTrigger. Precicely thedata-state="closed"andaria-expanded="false"attributes, which is can only be changed via user interaction (eitherhoverorclick). Please correct me if i'm wrong 🙏🏼Suppose I have a side-navigation and store the navigation state in localStorage
activeKeyandexpandKeys.activeKeycontains the menu key (id) that currently active, andexpandKeyscontains the array of string parent menu key (id). Let say my menu looks like these :When I click the
Sub Menu One Firstlink I'll store the key ofMenu OnetoexpandKeysand the key ofSub Menu One FirstinactiveKey. So when I reload the page I could easily find which sub-menu to expand and wich sub-menu item to be active.As far as my understanding of the documentation and the codebase, I can't see any clue to manually set
data-stateandaria-expandedvalue unless usingrefbut I'm not sure whether it will be overwrited byhoverorclickinteraction to the menu trigger.===
Update 23 May 24
Screen.Recording.2024-05-23.at.16.14.01.mov
For context, I'm having hard time figuuring out the way to implement vertical sidenav that will expanded when have it's submenu item activated.
Tried to use
force-mountprops on theNavigationMenuSubcomponent, but theirdata-stateis remainclosedandaria-expandedisfalse.Can anyone enlighten me 🙏🏼
Beta Was this translation helpful? Give feedback.
All reactions