-
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
Spacer block: Fix dimension control when no spacing presets are available #68818
Conversation
const handleOnChange = ( unprocessedValue ) => { | ||
onChange( unprocessedValue.all ); | ||
}; |
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.
Size Change: -13 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
I first deleted the spacing presets in theme.json, and then I re-added a single preset. Both cases are working, the correct control is showing.
What?
If no spacing presets are available then the dimension control is not supposed provide a way to pick from them.
It looks like the problem came about with #61842. In that PR, the method of accessing the presets in the Spacer block’s controls was changed and resulted in there always being at least one preset whereas before it may have been zero. That made the conditional display of a control for no presets unreachable and the control never shown.
Why?
To match the apparent intention of the implementation and improve the UI.
How?
onChange
adapter function only for the control with presets.Testing Instructions
Screenshots or screencast
In these the active theme specifies zero spacing presets:
spacer-single-default-preset-before.mp4
spacer-single-default-preset-after.mp4