Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation: Try unifying submenu arrow positioning. #37003

Merged
merged 4 commits into from Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion packages/block-library/src/navigation/style.scss
Expand Up @@ -94,9 +94,9 @@ $navigation-icon-size: 24px;
border: none;

// Scale to font size.
margin-left: 0.25em;
width: 0.6em;
height: 0.6em;
margin-left: 0.25em;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well.


svg {
display: inline-block;
Expand Down Expand Up @@ -312,6 +312,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
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/page-list/index.php
Expand Up @@ -197,7 +197,7 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click,
if ( isset( $page['children'] ) ) {
if ( $is_navigation_child && $show_submenu_icons && ! $open_submenus_on_click ) {
$markup .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">';
$markup .= '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>';
$markup .= '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg>';
$markup .= '</button>';
}
$markup .= '<ul class="submenu-container';
Expand Down