-
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
Adjust paragraph block spacing to use standardised variables #14679
Adjust paragraph block spacing to use standardised variables #14679
Conversation
There are a number of cases where a backgroud is added to a Block which then requires that the Block has padding within the Editor to make it look visally acceptable. These values are often hardcoded. To standardise these, we add vars for vertical and hoz padding for Blocks which have background applied.
Replaces existing values with equivalents but as variables. This will allow us to utilise these standardised vars elsewhere such as the Section Block.
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? Before:
After:
That maps to
That gets us only 2px from the 30, but that should be close enough. |
@jasmussen Really appreciate your feedback here.
No problem 👍
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 But 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:
Maybe this You can then keep the values 20px and 30px directly. |
I personally don't have any issues with long names. |
Did you push your changes or is it GitHub's cache issue? |
I too am not aware of any guidelines around how to name variables. Nor do I feel particularly strongly about any. |
Caching 41286af @aduth thanks for confirming. Could you @gziolo or @youknowriad approve this PR then? Much appreciated. |
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.
No rules 🤷♂️
🚢
…ss#14679) * Adds vars for Block padding when background present There are a number of cases where a backgroud is added to a Block which then requires that the Block has padding within the Editor to make it look visally acceptable. These values are often hardcoded. To standardise these, we add vars for vertical and hoz padding for Blocks which have background applied. * Adds new Block with background vars to paragraph Block Replaces existing values with equivalents but as variables. This will allow us to utilise these standardised vars elsewhere such as the Section Block. * Updates variable to BEM specification
Description
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.
Testing
To test just confirm that the values for
padding
on the<p class="wp-block-paragraph...
have the same values as onmaster
(ie:padding: 20px 30px
).