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

Menu Items: Lower the specificity of the fallback background color #42211

Closed
wants to merge 1 commit into from

Conversation

yashitamittal11
Copy link

@yashitamittal11 yashitamittal11 commented Jul 7, 2022

What?

This PR is lowering the specificity of the fallback background color for the menu items, so the color selected in the block settings is honored.

Why?

This PR solves the background color issue in the submenu items in the navigation block.
The issue exists on the Varia and its child themes.

How?

When using the Navigation block with the Varia and its child themes, the background color selected from the block settings is not honored. It is because the specificity of the fallback menu background color is higher than the CSS specificity of the selected block color.

This PR lowers the specificity of the fallback background color for the menu items to honor the user-selected settings.

Testing Instructions

  1. Activate Hever or any other Varia child theme on a site.
  2. Open a post or page and add the Navigation block.
  3. Add menu items and submenu items.
  4. Choose a background color(primary, secondary, foreground) for the navigation block.
  5. View the page. The background color should be visible on clocking the submenu.

Screenshots or screencast

| Before |

menu navigation-issue

| After |
Menu navigation - fixed

@github-actions
Copy link

github-actions bot commented Jul 7, 2022

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @yashitamittal11! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jul 7, 2022
@madhusudhand madhusudhand added [Block] Navigation Affects the Navigation Block [Block] Submenu Affects the Submenu Block - for submenus in navigation labels Jul 7, 2022
@tellthemachines
Copy link
Contributor

Thanks for your contribution @yashitamittal11 ! Are you able to reproduce this on a default theme such as Twenty Twenty Two or Twenty Twenty One? I notice the issue you linked to is not from a WordPress repo.

If it can't be reproduced in any of the default themes, we can still consider a request for lowering the specificity of a CSS rule (this is an area we are continuously trying to improve!) but it would be better in that case to open an issue so we can discuss this further, rather than directly submitting a PR.

I'd also add that this particular part of the code - background colors for the Navigation block - has already caused us much pain in the past, so any change we make will need extensive testing first 😅

@yashitamittal11
Copy link
Author

I checked this issue on the default theme Twenty Twenty Two and Twenty Twenty One, and the navigation block colors are working fine on those themes.

Should I open a new issue in the Gutenberg repo for further discussion?

@carolinan
Copy link
Contributor

carolinan commented Jul 7, 2022

Hi!
This issue needs specific testing. With the Emptytheme, I am getting different results depending on if the submenu is in a page list or is a submenu link item. For page list, the submenu background color option does not work at all in the editor, where the submenu background is always white (not transparent).

@carolinan
Copy link
Contributor

"Emptytheme" which has no theme styles for the navigation block that can conflict, can be found in the Gutenberg repo, in the test folder.

@tellthemachines
Copy link
Contributor

Should I open a new issue in the Gutenberg repo for further discussion?

That would be ideal, thanks @yashitamittal11 !

@yashitamittal11
Copy link
Author

yashitamittal11 commented Jul 8, 2022

Thanks, everyone! I have created a new issue here: #42256
I am not able to add labels or reviewers to the issue. Maybe I don't have permission.
Can someone please help me add the labels? 🙏

@andreszs
Copy link

andreszs commented Jul 13, 2022

This is a theme-specific design flaw, not a general Wordpress issue IMO.

@scruffian
Copy link
Contributor

This seems to be theme specific.

@scruffian scruffian closed this Aug 8, 2022
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 [Block] Submenu Affects the Submenu Block - for submenus in navigation First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants