Repository navigation
feat(NumberInput, Pagination): entryErrorBehavior on NumberInput - #11492
Conversation
…vior and a form default
DateInput, DateTimeInput, and TimeInput take `entryErrorBehavior`
('complete' | 'blur-or-enter'), and FormLayout carries
`defaultEntryErrorBehavior` on its layout context. A field resolves its
own prop, else the nearest FormLayout default, else 'complete'.
Under 'blur-or-enter', typing and native time edits reveal no rejection of
the field's own; Enter or blur reveals the entry's current rejection with
every signal together and one announcement, and the onEntryErrorChange
report moves to that commit. An edit that the field accepts or empties
clears at once. PowerSearch value editors and Table filter editors keep
'complete'.
NumberInput takes `entryErrorBehavior`, so a form can pass one value to all of its date, time, and number fields. A typed number is complete only at Enter or blur, so both values keep the field's current timing; the field keeps the prop off its input and reads no FormLayout default. Pagination's page box passes 'complete', as compositions keep their own entry error timing.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 90b7e59 |
…ry-error-behavior-number # Conflicts: # docs/families/input-fields.md # docs/specs/AST-117-validation-timing/spec.md # docs/specs/components/FormLayout/FormLayout.spec.md
|
/approve-spec f1d9731 |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet.
NumberInput now takes entryErrorBehavior and exports EntryErrorBehavior from its entry point, and Pagination's page box passes 'complete', as the entry error behavior spec asks; with or without the prop, under either value and inside a FormLayout, NumberInput keeps revealing its own rejections only at Enter or blur. Two small non-blocking notes are inline: the @output header list in NumberInput/index.ts, and a lone - state in the NumberInput record's FR14 verification row that the new cases do not type.
Claims and files checked
Claims
- Changeset: NumberInput takes
entryErrorBehaviorso a form can pass one value to its date, time and number fields: verified (NumberInput.tsx:430; the date and time fields already take it). - Changeset and description: under both values, typing shows no message,
aria-invalid, invalid styling, announcement or report, and Enter or blur shows them together, reports once and announces once: verified (the ten "NumberInput entryErrorBehavior" cases,NumberInput.rejectedEntry.test.tsx:848-930). - An edit that makes the text valid or empty clears the error at once and reports
null: verified (same cases). - Setting the prop or a FormLayout default changes nothing a person sees: verified (the same cases also pass on the base; the NumberInput and Pagination visual frames are unchanged in CI).
- Pagination's page box passes
'complete', so a FormLayout around it changes nothing: verified (Pagination.tsx:775; the Pagination FormLayout case). EntryErrorBehavioris exported from the NumberInput entry point: verified (index.ts:19; generated API delta).- The field keeps the prop off its input and reads no FormLayout default: verified (
NumberInput.tsx:702; "keeps the prop off the input", which fails on the base). - On the base, passing the prop to NumberInput fails to type-check: verified from the prop types, which have no open index signature.
150in a 10 to 100 field clamps to 100 at Enter and reveals nothing under both values: verified (clamp cases).- Removing Pagination's
'complete'fails no test, an equivalent mutant: verified (the Pagination case passes on the base). - The records drop the last NumberInput gap lines and the verification rows name the suites: verified (diff of the four records).
- Authored lines 189: verified.
- Lint has 0 errors and one inherited warning, and Prettier, knowledge, changeset and type checks pass: verified at this head.
- The description's test counts: stated for an earlier commit; the NumberInput, Pagination and FormLayout suites pass at this head (570 tests), and the full suite runs in CI.
Files
.changeset/entry-error-behavior-number.md: cleardocs/families/input-fields.md: cleardocs/specs/AST-117-validation-timing/spec.md: cleardocs/specs/components/FormLayout/FormLayout.spec.md: cleardocs/specs/components/NumberInput/NumberInput.spec.md: non-blocking note (FR14 verification row)packages/core/src/NumberInput/NumberInput.doc.mjs: clearpackages/core/src/NumberInput/NumberInput.rejectedEntry.test.tsx: clearpackages/core/src/NumberInput/NumberInput.tsx: clearpackages/core/src/NumberInput/index.ts: non-blocking note (header list)packages/core/src/Pagination/Pagination.test.tsx: clearpackages/core/src/Pagination/Pagination.tsx: clear
| NumberInputStatus, | ||
| NumberInputStatusType, | ||
| NumberInputEntryError, | ||
| EntryErrorBehavior, |
There was a problem hiding this comment.
Non-blocking: this line adds EntryErrorBehavior to the entry point, but the header's @output list (line 6) still ends at NumberInputEntryError, and the header's SYNC line asks to keep it in step. Add EntryErrorBehavior there.
| | FR5, FR13, AR4 | `NumberInput.coarse-pointer.a11y.chromium.spec.ts` | Coarse/non-coarse pointers at 390 and 1280 px, LTR/RTL, non-default themed end padding | Visible coarse-pointer steppers, hidden fine-pointer steppers, wrong end padding, or lost direct/keyboard entry fail. | `audit:NumberInput/behavior` | | ||
| | FR5 | `NumberInput.test.tsx` "a held stepper" suite | Hold and release; pointer cancel; a bound; clicks; a finger press | A commit per repeat, a repeat after the release, or a step after the field turns disabled or read-only fails. | `audit:NumberInput/behavior` | | ||
| | FR14, AR2 | TBD (gap): `NumberInput.test.tsx` entry error behavior suites | `-`; `1a`; `150` in 10–100; each value; Enter and blur | A signal before commit under `'blur-or-enter'`, a lone signal, an unannounced revert, or a change under `'complete'` fails. | `audit:NumberInput/behavior` | | ||
| | FR14, AR2 | `NumberInput.rejectedEntry.test.tsx` "NumberInput entryErrorBehavior" cases; `Pagination.test.tsx` FormLayout case | `-`; `1a`; `150` in 10–100; each value; Enter and blur | A signal before commit under `'blur-or-enter'`, a lone signal, an unannounced revert, or a change under `'complete'` fails. | `audit:NumberInput/behavior` | |
There was a problem hiding this comment.
Non-blocking: this row now names the "NumberInput entryErrorBehavior" cases, but its states still include a lone -, which those cases never type (they type 1a and 150). Adding '-' to the five configurations, or naming the rejected-entry suite's lone-minus cases here, makes the row true as written.
User need
A form that sets
defaultEntryErrorBehavioron its FormLayout, or passes oneentryErrorBehaviorto every field, cannot pass it to NumberInput: the prop does not exist there, so the call fails to type-check and the form needs a special case for its number fields. AST-117 gives the same option to all four members that reject entries. NumberInput already shows its rejections only at Enter or blur, because a typed number is complete only when the person commits it, so the option changes nothing a person sees in a NumberInput. Builders still need it so one form-wide choice reaches every member without a special case.Problem and solution fit
entryErrorBehavior?: 'complete' | 'blur-or-enter'. Both values keep its current timing: the message,aria-invalid, the invalid styling, the announcement, and theonEntryErrorChangereport appear together at Enter or blur, never while a person types. An edit that makes the text valid or empty clears them at once.<input>and reads no FormLayout default, because no value can change what it does.entryErrorBehavior="complete", as AST-117 FR7 asks of compositions.EntryErrorBehavioris also exported from the NumberInput entry point.This pull request sits on #11485, which adds the option to DateInput, DateTimeInput, TimeInput, and FormLayout.
Current specification
spec:AST-117FR1 (each member takesentryErrorBehavior; the type is exported asEntryErrorBehavior), FR2, FR3, FR4, FR7 (Pagination's page input keeps'complete'), DEC-5.component:NumberInputFR14: "A typed number is complete only at commit, so under either value the field marks and announces no rejection while the person types, and Enter or blur reveals the draft's current rejection".component:FormLayoutFR7;family:input-fieldsFR14.architecture:public-component-apiINV2 and INV3 (AST-117 DEC-3).No behavior change for people: with or without the prop, under either value, and inside a FormLayout with either default, NumberInput and Pagination behave as on the base.
Public delta and caller burden
NumberInputProps.entryErrorBehavior?: EntryErrorBehavior; theEntryErrorBehaviortype from@astryxdesign/core/NumberInput.defaultEntryErrorBehavior, else'complete'; both behave the same in NumberInput. Additive (spec:AST-017FR5).Design and alternatives
Field/useEntryErrorBehavior). Its result would be unused, because both values take the same path. The family record's Shared owner section says that NumberInput resolves nothing, and NumberInput FR14 says the field reads no FormLayout default. If a later change makes the values differ, the field calls the hook then.'complete'even though it cannot change the page box today, so the composition rule in AST-117 FR7 holds in the code, not only in the outcome.Evidence
'complete','blur-or-enter', ablur-or-enterFormLayout default, and acompletefield prop under that default. In all ten cases, typing1akeystroke by keystroke shows noaria-invalid, no invalid style, no message, an empty alert, and noonEntryErrorChangecall. The commit then shows all of them at once, reports{kind: 'unreadable', text: '1a'}once, and announces once. Emptying the text clears at once and reportsnull.150in a 10–100 field clamps to 100 at Enter and reveals nothing, under both values.FormLayout defaultEntryErrorBehavior="blur-or-enter":2.5shows nothing while typed, Enter marks it invalid, and2clears it.entryErrorBehavior="complete"from Pagination fails no test. That mutant is equivalent: NumberInput has no path on which the value changes anything.Scope
Components: NumberInput, Pagination
Testing
Head
abe8891117on #11485's head5b3078b36a. Node 24.22.1, pnpm 11.10.0. Every run below is at that head.No interaction spec is added or renamed, so
.github/scripts/playwright-legs.test.mjsis unaffected. Pagination has no accessibility audit spec.Self-review against the repository's review rules:
FormLayoutdefault"): the prop is destructured and unused.abe8891117.Writing rubric results
Records touched:
spec:AST-117,family:input-fields,component:NumberInput,component:FormLayout.