-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Block Supports: Extract reusable preset input control from spacing sizes and border radius controls #73787
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
Conversation
|
Size Change: -187 B (-0.01%) Total Size: 2.58 MB
ℹ️ View Unchanged
|
ramonjd
left a comment
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.
Great work getting this up so quickly.
Looking good so far.
Kapture.2025-12-09.at.15.41.02.mp4
I think the dropdown (with lots of border radius presets) positions itself outside the window border, but it also does on trunk.
packages/block-editor/src/components/preset-input-control/index.js
Outdated
Show resolved
Hide resolved
packages/block-editor/src/components/preset-input-control/index.js
Outdated
Show resolved
Hide resolved
06744b2 to
f4e0acf
Compare
|
I have:
I think this should be addressed via a separate follow-up. Assuming that follow-up, I think this PR is ready for additional testing and review. |
|
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. |
ramonjd
left a comment
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.
Nice work.
✅ Presets can be selected
✅ Custom values can be applied via toggle
✅ When excessive presets are in theme.json the control displays custom select control
✅ Values can be applied and saved correctly
✅ All global styles and block support controls still function as expected
There was a failing E2E related to the spinning button. It might be related. I kicked it off again just in case.
Otherwise, LGTM
|
Just a quick drive-by comment: I think the e2e test will need to be updated because the string in this PR has changed from
Hopefully nothing more significant than that! 🤞 (And great work on the consolidation @aaronrobertshaw!) |
|
Thanks for the reviews and testing @ramonjd and @andrewserong 🙇 I'll get this merged to unblock some of the follow-ups e.g. preset support for dimension block supports etc. |
Part of:
Follow up to:
What?
Extracts a resuable control component for a
PresetInputControlthat offers a segmented slider for choosing presets, a custom value toggle, and the ability to display a CustomSelectControl instead of the custom RangeControl slider if there are too many presets.Why?
More and more block supports are going to be using presets and share a similar UI. Currently, we already have Padding, Margin, and Border Radius block supports using this type of control.
Extracting this into a new reusable component will allow us to clean up the code for the existing block support UIs (
SpacingSizesControlandBorderRadiusControl), and then leverage it across a range of new and existing block supports that need preset functionality. These include:How?
PresetInputControlPresetInputControlaims to satisfy the slightly differing needs of the existing spacing and border radius controlsSpacingSizesControlto use new preset input controlBorderRadiusControlto use new preset input controlTesting Instructions
Test the existing controls for padding, margin, and border radius. Make sure that: