fix: Numeric value clearing in preset input controls#77139
fix: Numeric value clearing in preset input controls#77139DarkMatter-999 wants to merge 1 commit intoWordPress:trunkfrom
Conversation
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @DarkMatter-999! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
|
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. |
What?
Closes #77124
Fixes a bug where clearing numeric values in shared preset-based controls (used by inputs like margin and border radius) could retain a partial value (for example,
6after deleting60).Why?
When users clear numeric values with backspace in affected block controls, the intermediate partial value may be applied and persisted instead of the field becoming fully empty. This creates incorrect style values and inconsistent UX.
How?
Updates
PresetInputControlcustom value change handling so empty input is treated as a valid cleared state instead of being discarded asundefined. This allows the control to propagate a true empty value and avoids persisting transient partial numeric states during deletion.Testing Instructions
Testing Instructions for Keyboard
60in controls backed by preset input (e.g. Margin, Padding).6is retained.Screenshots or screencast
Before
number-input.mov
After
number-input-fix.mov
Use of AI Tools
I used GitHub Copilot as an assistive drafting and code-review aid for the PR.