-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Block Supports: Allow skipping spacing support serialization #31973
Block Supports: Allow skipping spacing support serialization #31973
Conversation
$has_padding_support = gutenberg_has_spacing_feature_support( $block_type, 'padding' ); | ||
$has_margin_support = gutenberg_has_spacing_feature_support( $block_type, 'margin' ); |
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.
Removed gutenberg_has_spacing_feature_support
as it was just a wrapper for gutenberg_block_has_support
. Unless the support config is changed to allow all spacing support with a single boolean it isn't needed.
Size Change: +15 B (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
@aaronrobertshaw Is this updating |
Fix dynamic block skip spacing support serialization check
51983c9
to
00d888d
Compare
My apologies @apeatling, I missed that I'd also updated I've just force pushed a rebase resolving the previous conflict in |
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.
This looks great to me, and +1 for adding this support -- it will also be useful for adding padding to the button block.
In the testing instructions, in step 4:
Block should still visually update
I think this is saying that the block should still visually update for other controls like color, but padding/margin changes don't visually reflect since you've already enabled skip serialization in an earlier step. This tests correctly and is very clear from watching the testing gif you've supplied, just wanted to clarify for others testing!
Thanks @stacimc, you are correct, I've updated the test instructions. Appreciate you taking the time to review this.
As soon as we get the required approval I'll merge this. |
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.
Tested well for me, and code looks good in comparison to other blocks that already have this opt out.
Related: #24874
Description
Background
As part of looking to add custom margins (gutters) to the column/s blocks, we run into an issue with the spacing block support styles being added as inline styles. This won't play nice with the CSS media queries that stack the columns at different viewports. These queries look to set a
flex-basis
for the column width taking into account margins so they stack correctly.This highlighted the fact that the option to skip serialization of the padding and margin block support styles wasn't available. This PR allows for that skipping of serialization.
How has this been tested?
Manually.
Test Notes
Test Instructions
customMargin
under thespacing
support in your theme.jsonblock.json
to enable both padding and margin support while skipping serialization - gistThe block's spacing shouldn't change although color selections etc should be applied and the block visually update
block.json
file to skip serialization (or any other dynamic block with spacing support) - gistScreenshots
Types of changes
New feature
Checklist:
*.native.js
files for terms that need renaming or removal).