diff --git a/packages/block-library/src/navigation-link/index.php b/packages/block-library/src/navigation-link/index.php index bae89606496ae..f01c4de6ebc26 100644 --- a/packages/block-library/src/navigation-link/index.php +++ b/packages/block-library/src/navigation-link/index.php @@ -215,15 +215,14 @@ function render_block_core_navigation_link( $attributes, $content, $block ) { } $html .= ''; + $html .= ''; + // End anchor tag content. if ( isset( $block->context['showSubmenuIcon'] ) && $block->context['showSubmenuIcon'] && $has_submenu ) { // The submenu icon can be hidden by a CSS rule on the Navigation Block. $html .= '' . block_core_navigation_link_render_submenu_icon() . ''; } - $html .= ''; - // End anchor tag content. - if ( $has_submenu ) { $inner_blocks_html = ''; foreach ( $block->inner_blocks as $inner_block ) { diff --git a/packages/block-library/src/navigation-submenu/edit.js b/packages/block-library/src/navigation-submenu/edit.js index e6ac37c579dc6..226b3fe430cf7 100644 --- a/packages/block-library/src/navigation-submenu/edit.js +++ b/packages/block-library/src/navigation-submenu/edit.js @@ -657,12 +657,12 @@ export default function NavigationSubmenuEdit( { /> ) } - { ( showSubmenuIcon || openSubmenusOnClick ) && ( - - - - ) } + { ( showSubmenuIcon || openSubmenusOnClick ) && ( + + + + ) }
diff --git a/packages/block-library/src/navigation-submenu/index.php b/packages/block-library/src/navigation-submenu/index.php index 59d4f300c226b..a81d1704a2a19 100644 --- a/packages/block-library/src/navigation-submenu/index.php +++ b/packages/block-library/src/navigation-submenu/index.php @@ -245,10 +245,10 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) { $html .= ''; - $html .= '' . block_core_navigation_submenu_render_submenu_icon() . ''; - $html .= ''; + $html .= '' . block_core_navigation_submenu_render_submenu_icon() . ''; + } if ( $has_submenu ) { diff --git a/packages/block-library/src/navigation/style.scss b/packages/block-library/src/navigation/style.scss index 45ef1969ade89..539409e23da95 100644 --- a/packages/block-library/src/navigation/style.scss +++ b/packages/block-library/src/navigation/style.scss @@ -85,7 +85,6 @@ $navigation-icon-size: 24px; align-self: center; // This one affects nested submenu indicators. line-height: 0; display: inline-block; - vertical-align: middle; font-size: inherit; // Affect the button as well. @@ -95,15 +94,18 @@ $navigation-icon-size: 24px; border: none; // Scale to font size. - margin-left: 0.25em; width: 0.6em; height: 0.6em; + margin-left: 0.25em; svg { display: inline-block; stroke: currentColor; width: inherit; height: inherit; + + // Position the arrow to balance with the the text. + margin-top: 0.075em; } } @@ -216,6 +218,11 @@ $navigation-icon-size: 24px; } } + // Push inwards from right edge of submenu. + .wp-block-navigation__submenu-icon { + margin-right: 0.25em; + } + // Reset the submenu indicator for horizontal flyouts. .wp-block-navigation__submenu-icon svg { transform: rotate(-90deg); @@ -245,7 +252,7 @@ $navigation-icon-size: 24px; } // Show submenus on click. - .wp-block-navigation-submenu__toggle[aria-expanded="true"] + .wp-block-navigation__submenu-container { + .wp-block-navigation-submenu__toggle[aria-expanded="true"] ~ .wp-block-navigation__submenu-container { visibility: visible; overflow: visible; opacity: 1; @@ -300,6 +307,18 @@ button.wp-block-navigation-item__content { cursor: pointer; } +// When set to open on click, a button element is used. +// We pad it to include the arrow icon in the clickable area. +// The padding can be blanket for click, since you can't set click and hide the icon. +.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle { + padding-right: 0.6em + 0.25em; // Same size as icon plus margin. + + + .wp-block-navigation__submenu-icon { + margin-left: -0.6em; + pointer-events: none; // Make the icon inert to allow click on the button. + } +} + /** * Margins diff --git a/packages/block-library/src/page-list/edit.js b/packages/block-library/src/page-list/edit.js index d52ebc3a8764e..0595decbc9624 100644 --- a/packages/block-library/src/page-list/edit.js +++ b/packages/block-library/src/page-list/edit.js @@ -196,7 +196,17 @@ const PageItems = memo( function PageItems( { } ) } > { hasChildren && context.openSubmenusOnClick ? ( - + <> + + + + + ) : ( { ! context.openSubmenusOnClick && - context.showSubmenuIcon && } + context.showSubmenuIcon && ( + + ) }