-
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
Spacing Support: Hide UI for disabled properties #31726
Spacing Support: Hide UI for disabled properties #31726
Conversation
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.
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.
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.
Also working well for me! 🙇
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:
customMargin
andcustomPadding
to 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.js
files for terms that need renaming or removal).