Skip to content

Commit

Permalink
fix(MenuItem): split menu items does not open sub-menu when navigatin…
Browse files Browse the repository at this point in the history
…g directly between two split menus (#1904)
  • Loading branch information
YuliaGold authored Jan 29, 2024
1 parent 61a50dd commit eab3a8b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/Menu/MenuItem/hooks/useMenuItemMouseEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,11 @@ export default function useMenuItemMouseEvents({
}
}, [
setSubMenuIsOpenByIndex,
splitMenuItemIconButtonRef,
index,
hasChildren,
splitMenuItem,
isMouseEnterOnIconButton,
prevIsMouseEnterOnIconButton,
isActive,
resetOpenSubMenuIndex,
setActiveItemIndex,
isMouseEnter
resetOpenSubMenuIndex
]);

useLayoutEffect(() => {
Expand Down Expand Up @@ -78,11 +73,16 @@ export default function useMenuItemMouseEvents({

if (!isActive && splitMenuItem) {
setActiveItemIndex(index);

if (isMouseEnterOnIconButton) {
setSubMenuIsOpenByIndex(index, true);
}
}
}, [
resetOpenSubMenuIndex,
prevIsMouseEnter,
isMouseEnter,
isMouseEnterOnIconButton,
setSubMenuIsOpenByIndex,
isActive,
setActiveItemIndex,
Expand Down

0 comments on commit eab3a8b

Please sign in to comment.