-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.Questions or issues with incorporating or styling blocks in a theme.[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
If a theme sets root padding in theme.json as a multi-value shorthand declaration, like so:
"styles": {
"spacing": {
"padding": "68px 32px"
}
}
it gets added to the body as expected: padding: 68px 32px;.
But if a user then sets root padding in global styles, and if they don't provide a value for all sides (say they only want to change the left/right padding, and keep the theme's top/bottom value), the shorthand is interpreted as a single value and results in incorrect CSS:
padding-top: 68px 32px;
padding-right: 20px;
padding-bottom: 68px 32px;
padding-left: 20px;
Step-by-step reproduction instructions
- Activate Empty Theme, and replace the content of its
theme.jsonwith:
{
"version": 2,
"settings": {
"appearanceTools": true,
"layout": {
"contentSize": "840px",
"wideSize": "1100px"
}
},
"styles": {
"spacing": {
"padding": "68px 32px"
}
},
"patterns": [ "short-text-surrounded-by-round-images", "partner-logos" ]
}
- In the Global Styles sidebar, under "Layout", change "Padding" by first clicking "Unlink sides" and then editing only one or two of the fields.
- Save and verify that incorrect CSS now appears attached to
.editor-styles-wrapperin the editor, andbodyin the front end.
Screenshots, screen recording, code snippet
No response
Environment info
No response
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
Metadata
Metadata
Assignees
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.Questions or issues with incorporating or styling blocks in a theme.[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended