How do I know when a submenu is active #8254
Replies: 2 comments 5 replies
-
I'll bring up
|
Beta Was this translation helpful? Give feedback.
-
I solved my problem with extracting the component inside the popover, give the popover a wrapperRef and then use useEffect inside the new componet to know when it has loaded. Maybe not the best way to solve it but it makes me go forward with this. React.useEffect(() => {
}, [hasCorrectHeight, item.name, setHasCorrectHeight, setHeight, triggerRef, wrapperRef]); So basically I used Menu for the top items with a SubmenuTrigger for the sub-menus and inside the submenu I am using Tree in order to get the correct expanding of the third level sub menus. Probably not the best way to do things but for now this will be the fastest way to get the menu to an accessible state. |
Beta Was this translation helpful? Give feedback.
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,
I have a problem that I can't find an answer to so I hope someone here can help me out.
I am doing a menu with a submenu where I need to run a javascript when the submenu is opening (need to set the height on the submenu based on the height of the topmenu + trigger a gtm interaction event).
The structure looks like this:
My problem is that MenuItem has a onHover that works well for triggering the setHeight method. But when I navigate the menu with keyboards this never triggers.
I tried the onAction method but this method never fire for a menu item that opens a sub menu. It only triggers when you are navigating to a href.
Idealy I would like a onPress or onOpening function I can use for triggering the height and gtm interaction event.
How can I achive this?
Beta Was this translation helpful? Give feedback.
All reactions