Skip to content

fix: Numeric value clearing in preset input controls#77139

Open
DarkMatter-999 wants to merge 1 commit intoWordPress:trunkfrom
DarkMatter-999:fix/preset-input-control-clear-empty-numeric-value
Open

fix: Numeric value clearing in preset input controls#77139
DarkMatter-999 wants to merge 1 commit intoWordPress:trunkfrom
DarkMatter-999:fix/preset-input-control-clear-empty-numeric-value

Conversation

@DarkMatter-999
Copy link
Copy Markdown

@DarkMatter-999 DarkMatter-999 commented Apr 8, 2026

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, 6 after deleting 60).

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 PresetInputControl custom value change handling so empty input is treated as a valid cleared state instead of being discarded as undefined. 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

  1. Open the editor and insert a block (for example, Paragraph).
  2. In block settings, set a numeric value like 60 in controls backed by preset input (e.g. Margin, Padding).
  3. Place the cursor in the numeric field and press backspace until cleared.
  4. Confirm the value is fully cleared (empty), and no partial value like 6 is retained.
  5. Repeat for at least one additional affected control to confirm shared behavior.

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.

@github-actions github-actions bot added the [Package] Block editor /packages/block-editor label Apr 8, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

👋 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.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Apr 8, 2026
@DarkMatter-999 DarkMatter-999 changed the title fix: input control clear empty numeric value fix: Numeric value clearing in preset input controls Apr 8, 2026
@DarkMatter-999 DarkMatter-999 marked this pull request as ready for review April 8, 2026 10:55
@DarkMatter-999 DarkMatter-999 requested a review from ellatrix as a code owner April 8, 2026 10:55
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: DarkMatter-999 <lakshyajeet@git.wordpress.org>
Co-authored-by: dpmehta <mehtadev@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka Mamaduka requested a review from aaronrobertshaw April 8, 2026 12:40
@Mamaduka Mamaduka added the [Type] Bug An existing feature does not function as intended label Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Block editor /packages/block-editor [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Numeric input fields retain partial values when cleared via backspace across multiple controls

2 participants