diff --git a/packages/block-library/src/navigation/view.js b/packages/block-library/src/navigation/view.js index cfb60cd0985404..ca593e7537ce94 100644 --- a/packages/block-library/src/navigation/view.js +++ b/packages/block-library/src/navigation/view.js @@ -137,7 +137,7 @@ const { state, actions } = store( } }, handleMenuFocusout( event ) { - const { modal } = getContext(); + const { modal, type } = getContext(); // If focus is outside modal, and in the document, close menu // event.target === The element losing focus // event.relatedTarget === The element receiving focus (if any) @@ -148,7 +148,8 @@ const { state, actions } = store( if ( event.relatedTarget === null || ( ! modal?.contains( event.relatedTarget ) && - event.target !== window.document.activeElement ) + event.target !== window.document.activeElement && + type === 'submenu' ) ) { actions.closeMenu( 'click' ); actions.closeMenu( 'focus' );