Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Adjust paragraph block spacing to use standardised variables #14679
Please see this discussion on the Section Block for context.
Essentially we need to ensure that all Blocks which apply padding when they have a background set have the same values set. To do this we need to create some new variables that match up with what is currently set on the paragraph Block.
Adjusting the paragraph Block values seems fraught with danger so we construct new vars to provide new vars which match the existing values.
To test just confirm that the values for
Thanks for creating this PR!
I love where you're coming from, and I think the instinct is right. But I think we should remember to separate UI from content. The variables you leverage are firmly UI values.
Perhaps we also don't need new variables just for the padding in paragraphs and section blocks, maybe we can just do this?
That maps to
That gets us only 2px from the 30, but that should be close enough.
@jasmussen Really appreciate your feedback here.
I didn't quite follow this. I am certainly considering them UI values. They are a core part of the UI which are needed elsewhere but are not captured in a variable. Therefore they represent a risk in the codebase if many disparate locations rely on them remaining consistent.
Ideally not. However, as you suggest for backwards compatibility reasons I'd be pretty nervous about changing these values. Who knows how many 3rd party Blocks rely on these? There are probably also locations within Gutenberg Core itself which rely on them remaining "as is".
Knowing the amount of work it took to get Section alignments working, I am not convinced that we can consider
I'm still not 100% sure why we can't introduce a new variable. A quick search in the Block library finds 4-5 uses of
Not trying to be awkward here, just wanting to ensure we
If we're not convinced then I'd be tempted to leave "as is" rather than reopen the Section block alignment again.
I was a bit unclear here. By UI I'm referring to the editor — the left navigation, the top editor bar, the right sidebar, but not the editing canvas, which I'm referring to as "content".
Which actually means my own suggestion to use the
So to summarize:
On a final nitpicky note, thanks for your patience — do we have some sort of BEM pattern we can follow for the variables? BEM expert @gziolo any thoughts? These feel a little long and exotic to me:
You can then keep the values 20px and 30px directly.
I personally don't have any issues with long names.
I too am not aware of any guidelines around how to name variables. Nor do I feel particularly strongly about any.