-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Remove CSS Custom Property in code block #27672
Conversation
Size Change: -119 B (0%) Total Size: 1.28 MB
ℹ️ View Unchanged
|
I thought some sizes are part of Global Styles and not theme dependent - for example The advantage I see with using a variable is that the font sizes will be the same in every context and will be more transparent to the user. With this change the font size will be smaller but the user won't be able to explicitly see why. |
Those variables are not present unless a particular theme declares them via theme.json, so we can't use them. This change won't affect anything because when the variable is not present the default value is taken. If a theme wants to set that particular value for font-size it should use the theme.json and the user will see it. |
Even for the default font sizes declared via the core theme.json we don't do it that way ― these variables won't be present if the theme declares different ones. For context, we explored the alternative introduced in the code block (use CSS Custom Property directly into the block's CSS). See "style hooks" for blocks in #22296 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
* Add preformatted block styles and font settings. * Add font size fallback. * Remove unnecessary overflow property and use `pre-wrap` instead. This is a more elegant solution compared to the previous one, which relied on overflow. * Remove editor.scss * Remove CSS custom property. This is the theme's job. For more information, see #27672 * Add stylesheet to `block.json` file This is added due to new requirement implemented in #25220 Co-authored-by: Ari Stathopoulos <[email protected]> * Add preformatted block to theme-json.md specs. * Fix preformatted block support information on theme-json.md specs. Co-authored-by: Ari Stathopoulos <[email protected]>
#27294 introduced the use of a CSS Custom Property to set the font size of the code block.
However, the property
--wp--preset--font-size--extra-small
is theme dependant, it doesn't exist unless a particular theme adds it. The mechanism for a theme to set the value of the font-size of a block is via theme.json:This PR reverts that change.