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

Submenu font-size theme.json variable incorrectly affects parent menu-item #39263

Open
Humanify-nl opened this issue Mar 7, 2022 · 6 comments · May be fixed by #39277
Open

Submenu font-size theme.json variable incorrectly affects parent menu-item #39263

Humanify-nl opened this issue Mar 7, 2022 · 6 comments · May be fixed by #39277
Labels
[Block] Navigation Affects the Navigation Block [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended

Comments

@Humanify-nl
Copy link

Humanify-nl commented Mar 7, 2022

Description

When we set the font size on a submenu in theme.json, the top level navigation item is wrongfully scaled to this value.

"core/navigation-submenu": {
  "typography": {
    "fontSize": "var(--font-size--small)"
  }
}

How to solve:

CSS:
The font-size is currently set on this selector: .wp-block-navigation-submenu

It should instead be on: wp-block-navigation__submenu-container

Current fix:
.wp-block-navigation-submenu { font-size: inherit; }

Step-by-step reproduction instructions

  1. Go to theme.json
  2. Under styles { block }, and set a font-size for core/navigation-submenu that differs from the top level menu
  3. See the font-size change in the submenu, and its parent anchor.

Screenshots, screen recording, code snippet

No response

Environment info

  • WP 5.9.1
  • Gutenberg 12.7.0

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@Humanify-nl Humanify-nl changed the title Submenu font-size variable on wrong div and incorrectly affects parent menu-item Submenu font-size theme.json variable incorrectly affects parent menu-item Mar 7, 2022
@annezazu annezazu added [Block] Navigation Affects the Navigation Block [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Bug An existing feature does not function as intended Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Mar 7, 2022
@jasmussen
Copy link
Contributor

Thanks for the ticket. Would you be up for making a pull request to add the font size inheritance (which seems like the right approach)? I'd be happy to review and help it land!

@Humanify-nl
Copy link
Author

Gladly! That will be a first for me! I'm proud to be contributing even if its a super small change.

Here is the pull request: 39277

@jasmussen
Copy link
Contributor

That's great, thanks so much! Although it's a small PR, I want to make sure that I test it properly, so this just a note that I'll give this a shot hopefully later today, otherwise tomorrow morning. It's an ideal 1-line PR so if all works well it should sail through 🚢

@Humanify-nl
Copy link
Author

Excellent. Thank you!

@kathrynwp
Copy link

Heya @jasmussen Looks like there was some discussion on the related PR, but it isn't ready to merge. Any chance of moving it forward, assuming the issue is still valid? Thanks!

@jasmussen
Copy link
Contributor

The PR had some solid approaches, but I recall it surfaced some unforseen challenges. I think it's best to ask on the PR itself, to see if some of the other reviewers had thoughts on how it should land.

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 [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
Projects
None yet
4 participants