Skip to content

Commit

Permalink
reduce CSS specificity so that we can customize the overlay using the…
Browse files Browse the repository at this point in the history
…me.json
  • Loading branch information
scruffian committed Oct 24, 2023
1 parent 2ddd30a commit 1e609fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ function render_block_core_navigation( $attributes, $content, $block ) {

$responsive_container_classes = array(
'wp-block-navigation__responsive-container',
'wp-block-navigation-overlay',
$is_hidden_by_default ? 'hidden-by-default' : '',
implode( ' ', $colors['overlay_css_classes'] ),
);
Expand Down
13 changes: 8 additions & 5 deletions packages/block-library/src/navigation/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ button.wp-block-navigation-item__content {
transform: translateY(0);
}
}

:where(.wp-block-navigation__responsive-container.is-menu-open) {
background-color: inherit;
}
.wp-block-navigation__responsive-container {
display: none;
position: fixed;
Expand Down Expand Up @@ -498,7 +502,6 @@ button.wp-block-navigation-item__content {
&.is-menu-open {
display: flex; // Needs to be set to override "none".
flex-direction: column;
background-color: inherit;

// Animation.
animation: overlay-menu__fade-in-animation 0.1s ease-out;
Expand Down Expand Up @@ -631,13 +634,13 @@ button.wp-block-navigation-item__content {
}

// Default menu background and font color.
.wp-block-navigation:not(.has-background)
.wp-block-navigation__responsive-container.is-menu-open {
:where(.wp-block-navigation:not(.has-background)
.wp-block-navigation__responsive-container.is-menu-open) {
background-color: #fff;
}

.wp-block-navigation:not(.has-text-color)
.wp-block-navigation__responsive-container.is-menu-open {
:where(.wp-block-navigation:not(.has-text-color)
.wp-block-navigation__responsive-container.is-menu-open) {
color: #000;
}

Expand Down

0 comments on commit 1e609fb

Please sign in to comment.