{{ message }}
Repository navigation
fix(studio): clamp NumberField commits to their bounds - #5947
Open
shuaiyafei wants to merge 1 commit into
Open
shuaiyafei wants to merge 1 commit into
shuaiyafei wants to merge 1 commit into
Conversation
Bound the numeric value before deduplicating and notifying the caller. Keep the bounded draft synchronized so the subsequent blur does not commit another value or emit a duplicate tracking event. Cover both bounds, one-sided bounds, a zero maximum, and a no-op at the already committed bound.
3 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
Clamp the exported
@hyperframes/studio/uiNumberField's committed value to itsminandmax.Why
With
value={24},min={0}andmax={100}, typing150and pressing Enter sends150toonCommit. With a minimum of 10, typing5, pressing Enter and then leaving the field produces two commits:[5, 10].These out-of-range commits can propagate invalid values and cause a second write at blur. Both cases reproduce through the public UI export with real Chrome keyboard input.
Related work
This is a self-contained correction. Open and historical NumberField PRs were checked before implementation. PR #4710 changes Select and shares the test file; the added cases here belong to the NumberField suite.
How
Apply the bounds before comparing with the last committed value and notifying the caller. Synchronize the bounded numeric draft so the following blur deduplicates correctly.
Base UI owns the focused editing text and formats it on blur. The captures below are taken immediately after Enter: the lower panel shows the value received by the caller.
Test plan
Local verification: macOS arm64, Bun 1.4.3 and Node 24.19.0.
GitHub Actions are awaiting maintainer approval for this fork PR. Remote tests have not executed.
All six new regression cases fail against the original NumberField source.
All 69 tests under
src/components/uipass, including upper/lower bounds, one-sided bounds, a zero maximum, and a no-op at an existing bound.Five real Chrome Headless Shell 152.0.7977.30 scenarios exercise keyboard input through the public UI export. They verify committed values, retained focus, and the following blur without duplicate commits.
Full workspace build and lint pass.
Complete pre-commit and commit-msg hooks pass, including typechecks, Fallow, lint, formatting, tracked-artifact and large-file checks.
Comment citations and the comment ratchet pass.
The commit is marked Verified by GitHub.
Unit tests added/updated
Manual testing performed — browser verification was automated, with before/after captures
Documentation updated (if applicable)
Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug
Before
Input
150, declared maximum100, caller receives150.After
The same input and Enter key, caller receives
100.AI-assisted implementation with Codex. The validation listed above was executed.