Skip to content

Commit

Permalink
disable show arrow button when open on click on
Browse files Browse the repository at this point in the history
  • Loading branch information
vcanales committed Nov 24, 2021
1 parent d77ed8c commit 1e5cfa6
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions packages/block-library/src/navigation/edit/index.js
Expand Up @@ -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 ),
};
Expand Down Expand Up @@ -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 && (
<ToggleControl
checked={ showSubmenuIcon }
onChange={ ( value ) => {
setAttributes( {
showSubmenuIcon: value,
} );
} }
label={ __( 'Show icons' ) }
/>
) }

<ToggleControl
checked={ showSubmenuIcon }
onChange={ ( value ) => {
setAttributes( {
showSubmenuIcon: value,
} );
} }
disabled={
attributes.openSubmenusOnClick
}
label={ __( 'Show arrow' ) }
/>
</>
) }
</PanelBody>
Expand Down

0 comments on commit 1e5cfa6

Please sign in to comment.