File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,8 @@ function CascadingMenuItem({
5353 onClick ?.( event )
5454 } }
5555 onMouseOver = { ( ) => {
56+ // Close any existing child submenu when hovering over a regular menu item
57+ // Note: This logic is duplicated in CascadingSubmenu for consistency
5658 if ( parentPopupState ?. childHandle ) {
5759 parentPopupState . childHandle . close ( )
5860 parentPopupState . setChildHandle ( undefined )
@@ -80,9 +82,25 @@ function CascadingSubmenu({
8082 parentPopupState,
8183 } )
8284
85+ const { onMouseOver : originalOnMouseOver , ...hoverProps } =
86+ bindHover ( popupState )
87+
8388 return (
8489 < >
85- < MenuItem { ...bindFocus ( popupState ) } { ...bindHover ( popupState ) } >
90+ < MenuItem
91+ { ...bindFocus ( popupState ) }
92+ { ...hoverProps }
93+ onMouseOver = { event => {
94+ // Close any existing sibling submenus before opening this one
95+ // Note: This logic is duplicated from CascadingMenuItem for consistency
96+ if ( parentPopupState ?. childHandle ) {
97+ parentPopupState . childHandle . close ( )
98+ parentPopupState . setChildHandle ( undefined )
99+ }
100+ // Call the original hover handler to open this submenu
101+ originalOnMouseOver ( event )
102+ } }
103+ >
86104 { Icon ? (
87105 < ListItemIcon >
88106 < Icon />
You can’t perform that action at this time.
0 commit comments