WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10k stars 4.02k forks source link

Should blockGap be used to set padding for .has-background padded blocks? #34588

Open richtabor opened 2 years ago

richtabor commented 2 years ago

What problem does this address?

Ultimately, inconsistent visual rhythm of a site's design.

Gap is the vertical/horizontal rhythm of content, of which is also relevant as the gap between these blocks that support background color, and the content within them. So instead of using arbitrary values for this padding, let's consider using the blockGap value to also define the padding in these blocks.

What is your proposed solution?

Instead of using $block-bg-padding--v and $block-bg-padding--h, which are 1.25em and 2.375em respectively, perhaps we use the following:

$block-bg-padding--v: var(--wp--style--block-gap, 1.25em);
$block-bg-padding--h: calc(var(--wp--style--block-gap, 1.25em) * 1.9); // 2.375em

This would result in using the exact same values as today, for themes that do not support theme.json (or that have opted out of supporting blockGap) while allowing themes that do leverage blockGap to have more appropriate spacing rhythm throughout the site's design language.

Screenshots:

.has-background padding adapting, based on a smaller blockGap setting:

Screen Shot 2021-09-06 at 11 07 34 AM

.has-background padding adapting, based on a larger blockGap setting:

Screen Shot 2021-09-06 at 11 07 14 AM

Just tossing some ideas out. :)

scruffian commented 2 years ago

Yes I love this idea!