-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
New CSS properties (WP 6.4) in editor.min.css are overwriting font sizes from theme.json #56293
Comments
I can reproduce it. The problem seems to be that the following styles: .editor-styles-wrapper {
--wp--preset--font-size--normal: 16px;
--wp--preset--font-size--huge: 42px;
} have priority in the CSS cascade over these styles: body {
--wp--preset--font-size--normal: <generated-value>;
} I can see that we're defining the gutenberg/packages/block-library/src/common.scss Lines 11 to 15 in e95bb8c
gutenberg/packages/block-library/src/editor.scss Lines 66 to 71 in e95bb8c
It seems redundant to me to define them in 2 places and removing the second one fixes the problem. I'm worried that it might have some backwards-compatibility problems though. Does this fix make sense to you @oandregal @andrewserong ? |
It looks like the rules were added in two places back in #37381, perhaps @oandregal might know more about why it was in both places? If we need to keep the additional rule in |
Oh, I've been living under a rock because I didn't know about I'll wait for @oandregal's response because the |
The code at #37381 was part of 5.9. Something else must have changed in 6.4 so that it worked properly in 6.3 (and before?). Before jumping into a fix, I'd like to understand what changed. |
So, in 6.4, the global styles are appended to the editor without being transformed: they use |
Here's what I know:
We're now in a weird place, because there may be a few cases:
We need to provide the backward-compatible font size styles in both, though each needs its own CSS. I'm going to ping @ellatrix here, for thoughts on how to fix this issue. |
Scoping should only be added in case the editor is not iframed, This already happens for editor styles passed through the block editor setting or the canvas prop. But I guess there's some other cases where either the CSS added in a different way or through a loaded stylesheet. If you're adding styles dynamically, it should be easy to check whether the editor is iframed, and then don't add the Didn't |
Based on the investigation above, using :where should be enough and adequate to fix this. In light of #46752 it seems worth revisiting the usage of
|
Make a PR test here: #56564 |
It should be fine to remove the class from layout but we'll need to check if the specificity change doesn't affect anything. |
Reopening for further consideration of issue reported in Core's Trac ticket 59835, which highlights the same GB PR #46752 but the changes in the
@ellatrix is this bug report related? Or should a new issue be opened to address it? |
Hi, |
@ellatrix any chance you can help answer @hellofromtonya's question? This is related to an issue that would be great to be fixed in the next 6.4 maintenance release which is scheduled for 30 January |
By which stylesheet are these reset styles overriden? Worth noting that reset styles are supposed to be overridden by the theme, so it would be good to debug what is overriding them and why that is not expected. How do I reproduce the issue and with what theme? |
A new issue also sounds good :) |
Hi, |
It's not great, and I'm not proud of it, but here's a potential quick fix: |
As far as I've researched, this issue was fixed in WP6.5 and then we had a similar issue with the latest Gutenberg plugin. See the survey results here. And since this problem should have been fixed with #60400 I would like to close this issue. |
Description
I discovered a weird issue in WP 6.4.
There is CSS for editor styles (editor.min.css):
These properties are overwriting my font sizes from theme.json with slugs “normal” and “huge.”
These properties weren’t there in WordPress 6.3!
Because of that, in the Editor blocks with these properties are displaying with incorrect font sizes taken from these properties.
For example, my font size style with the slug “normal” is 24px. However, because of these properties in editor.min.css the block with “normal” font-size becomes 16px. The same issue occurs with the “huge” font-size… However, in the frontend, everything is okay.
Why are these properties there? Maybe it’s a mistake?
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
WordPress 6.4.1
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
The text was updated successfully, but these errors were encountered: