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 removing :where for menu show/hiding #42964

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions packages/block-library/src/navigation/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@ $navigation-icon-size: 24px;
// Styles for submenu flyout.
// These are separated out with reduced specificity to allow better inheritance from Global Styles.
.wp-block-navigation .has-child {
// We use :where to keep specificity minimal, yet still scope it to only the navigation block.
// That way if padding is set in theme.json, it still wins.
// https://css-tricks.com/almanac/selectors/w/where/
:where(.wp-block-navigation__submenu-container) {
.wp-block-navigation__submenu-container {
background-color: inherit;
color: inherit;
position: absolute;
Expand Down Expand Up @@ -233,7 +230,7 @@ $navigation-icon-size: 24px;

// Custom menu items.
// Show submenus on hover unless they open on click.
&:where(:not(.open-on-click)):hover > .wp-block-navigation__submenu-container {
&:not(.open-on-click):hover > .wp-block-navigation__submenu-container {
visibility: visible;
overflow: visible;
opacity: 1;
Expand All @@ -243,7 +240,7 @@ $navigation-icon-size: 24px;
}

// Keep submenus open when focus is within.
&:where(:not(.open-on-click):not(.open-on-hover-click)):focus-within > .wp-block-navigation__submenu-container {
&:not(.open-on-click):not(.open-on-hover-click):focus-within > .wp-block-navigation__submenu-container {
visibility: visible;
overflow: visible;
opacity: 1;
Expand Down