Repository navigation
A Parameter's Value, Min, Max and Step say when what you type is not a number - #665
Merged
Merged
Conversation
…a number These four Inspector fields marked a draft that is not a finite number (a half-typed `-` or `1e`, an overflow such as `1e400`) with aria-invalid only, and a `-` typed into an empty Min, Max or Step was not marked at all: the number input reports '' before and after, so React's onChange never ran. DraftNumberInput now also handles the native input event while the field shows '' (validity.badInput tells a half-typed number from a blank), and the four fields show the new hint "Enter a finite number." (inspector.number.finiteHint, 18 locales) while the draft is not a number, as a Pool's capacity shows its own. A blank Min, Max or Step is still allowed and a blank Value is not; nothing invalid is stored. Part of #615
Deploying cozy-loop-studio with
|
| Latest commit: |
d2470a8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a5a00aa1.cozy-loop-studio.pages.dev |
| Branch Preview URL: | https://parameter-finite-number-hint.cozy-loop-studio.pages.dev |
This was referenced Nov 24, 2026
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.
Part of #615 (follow-up: Min / Max / Step hints; Value included by Lumi's scope).
What was wrong
Measured on main
5855c9ee:-or1e, an overflow such as1e400) witharia-invalidonly; no hint text. A Pool's Capacity shows its own hint ("Enter a number that is 0 or greater.") for the same drafts.-typed into an empty Min, Max or Step was not marked at all. The browser does send the nativeinputevent, withvalidity.badInputtrue, but the input reports''before and after, so React'sonChange(which fires only when the value changes) never ran. The Backspace that removes the-again also comes only as aninputevent.The change
DraftNumberInputalso listens toonInput, and handles it only while the field shows''(whenever it shows anything else,onChangeruns for the same event). There it records the half-typed state fromvalidity.badInput, so the field is marked; a following Backspace makes it a real blank again. A blank that would only set what is already stored commits nothing.FiniteNumberFieldthat shows the new hint "Enter a finite number." inside the field while the draft is not a number, asNonNegativeNumberFielddoes for a Pool.min ≤ max,step > 0) are unchanged.inspector.number.finiteHintin all 18 locales. The key-count pins move from 1542 to 1543 (runtime 1817 to 1818) in the it, nl, pt-PT, ru, th, tr and vi copy tests.docs/specs/SEMANTICS-M.md§M1.2 states the editing rule.Tests
New describe in
e2e/number-field-blank.spec.ts:-shows the hint andaria-invalid, then3(-3) clears it and is stored;1eshows it, leaving clears it;1e400shows it, Backspace to1e40clears it;-then Backspace: a blank clears it for Min, Max and Step (stored blank) and keeps it for Value (stored value kept, cleared on leaving). Nothing invalid is stored at any point.-typed into the empty field is marked with the hint; leaving clears it and the field stays blank.-and-3, stores nothing for them, and a blank still means unlimited.On main's code, tests 1 fail at the first hint check and tests 2 at the first
aria-invalidcheck; the control passes.Updated: the #615 item 2 test in the same file now expects the new hint for Min, Max and Step;
e2e/parameter-inputs.spec.tsfinds the Value field by role and a name that may carry the hint (the hint is inside the label, so it joins the field's accessible name while it shows, as Capacity's does).On this branch,
--workers=1 --retries=0:e2e/number-field-blank.spec.ts(chromium): 20 passed.e2e/node-value-overflow.mobile.spec.ts(mobile): 2 passed.parameter-inputs,field-undo,monte-carlo,step-length-field,rtl-form-direction,mc-invalidation,inspector-kind-label,node-value-overflow(chromium): all passed.Every
check:*script,tsc -b, lint (88 warnings, the baseline, none in the changed components) andvitest run(5758 passed) pass.