Repository navigation
fix(NumberInput): bound the separator alphabet and read the machine decimal point - #5459
Merged
Merged
Conversation
…ecimal point #5450 decided which characters may separate digits from the input itself: unbounded for grouping, locale-only for the decimal point. Both halves are wrong, and they are the same decision. - A full stop the locale cannot read as grouping now reads as the decimal point it can only be, so de-DE 1.5 commits 1.5 again instead of 1. It is tried after the locale reading, not before it like dateParser.ts's ISO branch, because 1.234 in de-DE genuinely has two readings and grouping is the one a German means. - Only the characters some locale writes between digits are separators, so 123-456-789 is not 123456789. - An explicit sign inside accounting parens refuses instead of flipping. Every defect gets a corpus row, formatEditableNumber gets its first tests.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsNumberInput (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
added a commit
that referenced
this pull request
Aug 25, 2026
…at the parser actually does (#5468) * fix(NumberInput): drop U+00B7 from the separator alphabet, say what the parser does Post-merge audit of #5459. - The file docblock still promised that anything with two readings refuses. It does not: where both a grouping and a decimal reading are well formed the locale's wins, so de-DE `1.234` is 1234 and `1.2345` is 1.2345. Say so. - U+00B7 was in the alphabet as the Catalan middle dot. Catalan groups with a full stop; walking the 136 locales Intl serves finds no locale that writes a middle dot between digits. Remove it and pin the refusal. - The changeset read as though a structured non-number is now refused. The alphabet bounds characters, not shapes: `192.168.100.200` still commits. Corpus also gains the fr-FR half of the ambiguity rule. * test(NumberInput): say why the ar-SA editable spelling keeps Latin digits * fix(NumberInput): make the docblock rule true of readUnder, drop the dead U+00B7 test Review of #5468. - The stated rule ignored readUnder's leading-chunk guard, so it got de-DE `1234.567` and en-US `1234,567` wrong in both directions. Stated as code it disagreed with the parser on 8 of 17 inputs; it now says every group has to fit the locale's sizes, and names the cross-locale reading it also omitted. probe-kit/numberparser-docblock-rule.mjs: 0 of 35 hand-picked and 0 of 6300 generated inputs disagree. - isGroupOnlySeparator still matched U+00B7. Dead — NUMBER_BODY rejects it first — but it sat under the paragraph saying the character was removed. - The sweep behind the alphabet is every language ICU resolves in every region, not a hand-written 136. That walk finds a seventh character, U+060C (nqo), which the alphabet still leaves out. Wording only. - The ar-SA row claimed the localized separator is what makes the round trip hold. It is not: the plain `String` spelling round trips too. Say the real reason — the digits are what the field shows at rest. * test(NumberInput): land the docblock grader in the repo, and say what it stopped saying Review round 2 of #5468. - The rule paragraph under-predicted a space or apostrophe, which groups after ONE occurrence: en-US `1 234` is 1234 and the corpus asserts it. Add the clause. - The out-of-repo probe reported zero disagreements because its prediction borrowed `isGroupOnlySeparator`'s own rule from the implementation while claiming to implement the sentence. A grader that borrows from the thing it grades cannot fail. numberParser.docblock.test.ts is derived only from the words: each branch names the clause it implements, and those clauses are asserted verbatim against the source, so a paragraph that loses one fails here. 32,550 generated inputs, zero disagreements. - "text no reading fits" was missing a "that". The grader re-derives the locale's symbols from Intl, so it goes on the no-raw-intl-locale test-oracle allowlist with its own rule test.
This branch was successfully 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.
Fast follow on #5450, which merged (
32a62fd) before its review finished. Two blocking defects and one small one are live onmain; this fixes all three.The one decision
#5450 decided which characters may separate digits from the input itself — unbounded for grouping, locale-only for the decimal point. Both halves are wrong, and they are the same decision. This bounds the alphabet and adds the reading the locale could not supply.
utils/dateParser.tsalready answers both halves — a literal([-/.])separator set and a machine-format branch — and this matches its shape, with one deliberate difference noted below.B1 — the machine decimal point stopped parsing in comma-decimal locales
Measured in real Chromium, de-DE field, two Storybooks side by side (
main@32a62fdvs this branch):main)1.51.51234.56-3.251,51.234A full stop the locale could not read is not well-formed grouping either, so exactly one reading is left and refusing it lost a number the person typed.
Where dateParser's shape is deliberately not matched: it tries ISO first because
2026-01-25has no second reading. Here1.234in de-DE genuinely has two, and grouping is the one a German means — so the machine reading is tried after the locale reading, not before it.1.234→ 1234;1.2345→ 1.2345.B2 — junk committed as a number
123-456-7891-800-5551_234_5671/234/5671:234:567800-555-1212and2024-01-15were refused before only because their last group is the wrong length — luck, not a rule. Now the rule holds: only comma, full stop, the space family, the Swiss apostrophes, the Catalan middle dot, and the Arabic separators count.%gets an asserted corpus row too —45%is null, deliberately, because the field has no percent semantics.B3
(+1,234)was -1234 and(-1,234)was +1234 — the paren sign and the leading sign each flipped and composed. An accounting paren already says negative, so a sign inside it reads two ways; both refuse now.Nothing #5450 got right moved
Same two-sided run, all unchanged:
1,234,234,234in en-US/de-DE/every locale,1.234.234.234de-DE,1,5de-DE = 1.5,1,5en-US = null,$1,234.56,(1,234),1,234 GBrefused, Arabic-Indic١,٢٣٤, and the full-width IME composition. All four of #5110's regressions stay cleared, including therole="alert"announcement.Test plan
formatEditableNumberhad zero tests; it now has explicit rows plus a round-trip assertion over 8 locales × 13 values.pnpm vitest run packages/core/src/NumberInput packages/core/src/utils— 526 passed.main:probe-kit/b1b2b3-two-sided.cjs(24 cases, realinsertFromPastevia clipboard + Cmd+V, plus a CDP IME composition). Reviewer'sreview-shots-5450/parser-battery.mjsre-run clean.No API change.
formatValueuntouched.NumberInput.tsxuntouched.@cixzhang