From 1e5cfa6cc10f26eacee39f0d6ab58b994bcbd82f Mon Sep 17 00:00:00 2001 From: Vicente Canales Date: Wed, 24 Nov 2021 11:56:09 -0300 Subject: [PATCH] disable show arrow button when open on click on --- .../src/navigation/edit/index.js | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/packages/block-library/src/navigation/edit/index.js b/packages/block-library/src/navigation/edit/index.js index 9bea01a768ba1..b8612b00a8cf0 100644 --- a/packages/block-library/src/navigation/edit/index.js +++ b/packages/block-library/src/navigation/edit/index.js @@ -142,12 +142,12 @@ function Navigation( { blockEditorStore ); const blocks = getBlocks( clientId ); - const firstSubmenu = blocks.find( + const didFindSubmenu = !! blocks.find( ( block ) => block.name === 'core/navigation-submenu' ); return { - hasSubmenus: !! firstSubmenu, + hasSubmenus: didFindSubmenu, innerBlocks: blocks, isInnerBlockSelected: hasSelectedInnerBlock( clientId, true ), }; @@ -420,21 +420,26 @@ function Navigation( { onChange={ ( value ) => { setAttributes( { openSubmenusOnClick: value, + ...( value && { + showSubmenuIcon: true, + } ), // make sure arrows are shown when we toggle this on. } ); } } label={ __( 'Open on click' ) } /> - { ! attributes.openSubmenusOnClick && ( - { - setAttributes( { - showSubmenuIcon: value, - } ); - } } - label={ __( 'Show icons' ) } - /> - ) } + + { + setAttributes( { + showSubmenuIcon: value, + } ); + } } + disabled={ + attributes.openSubmenusOnClick + } + label={ __( 'Show arrow' ) } + /> ) }