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: Apply color classes to the navigation container element #50968

Merged
merged 4 commits into from
May 25, 2023

Conversation

scruffian
Copy link
Contributor

What?

Makes the navigation submenu blocks inherit their color from the navigation block. Fixes #50235

Why?

On trunk when a navigation block sets a background color the submenus lose their color which cases issues like #50235.

How?

We just needed to add the right classes to the container block.

Testing Instructions

  1. Add a navigation block
  2. Set a background color for the block but not for the submenus/overlay
  3. Open the site in the front end
  4. Check that the submenus still have a background color set.

Testing Instructions for Keyboard

Screenshots or screencast

Screenshot 2023-05-25 at 15 20 35

Props to @MaggieCabrera who found the issue.

@@ -524,7 +524,7 @@ function render_block_core_navigation( $attributes, $content, $block ) {

if ( $is_list_item && ! $is_list_open ) {
$is_list_open = true;
$inner_blocks_html .= '<ul class="wp-block-navigation__container">';
$inner_blocks_html .= '<ul class="wp-block-navigation__container '.implode( ' ', $classes ).'">';
Copy link
Contributor

Choose a reason for hiding this comment

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

this will only work for preset colors, not custom ones, sadly

@github-actions
Copy link

github-actions bot commented May 25, 2023

Flaky tests detected in 299b146.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5081878086
📝 Reported issues:

Copy link
Contributor

@MaggieCabrera MaggieCabrera left a comment

Choose a reason for hiding this comment

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

this is looking good to me, I couldn't get it to break :D

scruffian and others added 3 commits May 25, 2023 16:29
@scruffian scruffian enabled auto-merge (squash) May 25, 2023 16:03
@scruffian scruffian merged commit 330dac9 into trunk May 25, 2023
@scruffian scruffian deleted the fix/50235-3 branch May 25, 2023 16:12
@github-actions github-actions bot added this to the Gutenberg 16.0 milestone May 25, 2023
@ndiego ndiego added the [Type] Bug An existing feature does not function as intended label Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing the background color on a vertical menu, submenus are not displayed correctly
3 participants