diff --git a/packages/block-library/src/navigation/edit/index.js b/packages/block-library/src/navigation/edit/index.js index 90fa24172d083..c27bccadc69cb 100644 --- a/packages/block-library/src/navigation/edit/index.js +++ b/packages/block-library/src/navigation/edit/index.js @@ -134,13 +134,19 @@ function Navigation( { `navigationMenu/${ ref }` ); - const { innerBlocks, isInnerBlockSelected } = useSelect( + const { innerBlocks, isInnerBlockSelected, hasSubmenus } = useSelect( ( select ) => { const { getBlocks, hasSelectedInnerBlock } = select( blockEditorStore ); + const blocks = getBlocks( clientId ); + const firstSubmenu = !! blocks.find( + ( block ) => block.name === 'core/navigation-submenu' + ); + return { - innerBlocks: getBlocks( clientId ), + hasSubmenus: firstSubmenu, + innerBlocks: blocks, isInnerBlockSelected: hasSelectedInnerBlock( clientId, true ), }; }, @@ -411,26 +417,35 @@ function Navigation( { label={ __( 'Always' ) } /> -