Repository navigation
Spacing Support: Hide UI for disabled properties - #31726
Merged
aaronrobertshaw merged 5 commits intoMay 12, 2021
Merged
aaronrobertshaw merged 5 commits into
aaronrobertshaw merged 5 commits into
Conversation
stacimc
marked this pull request as ready for review
May 11, 2021 20:54
aaronrobertshaw
self-requested a review
May 12, 2021 01:01
aaronrobertshaw
approved these changes
May 12, 2021
aaronrobertshaw
left a comment
Contributor
There was a problem hiding this comment.
Thanks for catching this @stacimc!
The spacing support controls need to check both whether the block opted into the support feature as well as if the theme disabled the UI for that feature.
I mistakenly thought the disabled check didn't take into account the block's support flags and pushed a commit adding it as well. My mistake. That's been reverted. Sorry.
This now tests well for me in both the block editor and site editor.
75 of 82 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes issue #31725
The Spacing block support has support for both padding and margin independently; it is possible for a theme to opt in to only one or the other. Currently the UI for both is displayed as long as the block supports that feature, and the theme supports either feature. This PR updates the block support to only display the UI if it is supported by both the block and the theme.
How has this been tested?
Manually
To test, you need a block that supports both padding and margin. I used Site Title and updated the block.json to include:
You also need to update your theme.json to enable customPadding, but disable customMargin:
customMarginandcustomPaddingto true. Verify that now both Margin & Padding controls display.customMargin, and verify that now only Margin controls display.Screenshots
The Spacing panel when both Padding & Margin are supported by both the block and the theme:

The Spacing panel when the block supports both Padding & Margin, but the theme only supports Margin:

Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.jsfiles for terms that need renaming or removal).