Update global padding CSS Custom Properties to adhere to established theme.json patterns #49809
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
This PR updates the way
styles.spacing.padding
properties are parsed fromtheme.json
into CSS Custom Properties so that they adhere to the established rules on how CSS Custom Properties are generated fromtheme.json
.Why?
The process to set padding values in the
styles.spacing
section oftheme.json
is as follows:This outputs the following CSS Custom Properties:
However, according to the established pattern which is also documented in the Block Editor Handbook, what should actually have been generated is:
Because
top
,right
,bottom
, andleft
are keys inside thepadding
object.Padding
effectively is the category here (to use the language of the Block Editor Handbook), and while in CSS, we are used topadding-right
,padding-left
etc,theme.json
should adhere to its own conventions first for consistency, predictability, and a better developer experience.How?
This is to close #49801, if accepted as the right proposal. Right now the Global Padding variables don't follow the rules set out for how the rest of theme.json properties are converted into CSS Custom Properties. This fixes that by adding a
--
betweenpadding
and the key after.Testing Instructions
body
the following properties are outputted:Testing Instructions for Keyboard
Not applicable
Screenshots or screencast