Repository navigation
fix(DateInput, DateTimeInput): keep rejected date entries and show why - #11407
Conversation
Text that is not a date no longer marks the field invalid or announces on each keystroke. Enter or blur keeps the text and shows "Invalid date" as the field's error status, with `aria-invalid` and one announcement. The message replaces a caller `status`, as the field's other rejections do; with `onEntryErrorChange`, a caller `error` status with a message still wins. The callback reports unreadable text at Enter or blur. A native date control flags no partial year while the year is typed. Its rejection shows at Enter or blur, with the out-of-range message a typed date shows, and stays shown after blur restores the committed date until the control reports a date the field accepts or nothing. In DateTimeInput the native date segment's message is the field status. A shown rejection stays through an edit that leaves the date wrong or unfinished, and a changed message is announced once. A locked field hides it and shows it again once editable. What a form posts does not change. While Enter or blur keeps text that is not a date, a hidden input posts the committed date under the field's `name`, the text input carries no `name`, and the next Enter submits the form. Kept unfinished, nonexistent, or out-of-range text still posts its typed text. The DateInput and DateTimeInput records, the input-fields family, and the rejected-entry record drop the date gaps and name the tests.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DateInput · Storybook | 195.2 kB (+725 B) · 17.4 kB CSS (0) | 6,402 (+157) | ✗ · ✓ · ✓ |
| DateTimeInput · Storybook | 217.6 kB (+599 B) · 19.1 kB CSS (0) | 3,684 (+43) | ✗ · ✓ · ✓ |
| PowerSearch | 301.7 kB (+731 B) · 24.7 kB CSS (0) | — | — · — · — |
Visual changes: 14 snapshots in 2 components
A change is a question for the reviewer, not a failure.
2 more are in the run's visual report.
Package size: @astryxdesign/core 7.42 MB packed (+3.9 kB); no new dependencies.
Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested. The typed-entry fix follows the DateInput and DateTimeInput records, but two points need fixing first:
- With
onEntryErrorChangeset, a refused native date still replaces the caller'serrorstatus message (NativeDateField.tsx:365-368andDateTimeInput.tsx:1094-1097, andDateInputdrops the callback before the native surface), although the updatedstatusdocs and DateInput's validation clause say the caller's message wins for native picks too, so honor the callback there and add a test per surface. - The changeset says rejected dates now meet WCAG 2.2 1.4.1 and 3.3.1, but inside an InputGroup they still show no visible message, so scope the sentence to standalone fields (for example "In a standalone field, rejected dates now meet …; inside an InputGroup they set
aria-invalidand are announced").
CI has not run on this draft head yet.
Claims and files checked
- Claim: rejected dates now meet WCAG 1.4.1 and 3.3.1. False for grouped fields (see above).
- Claim: before, unreadable text was flagged and announced while typing and reverted at Enter or blur. Verified against the base
useTypedDate.ts(typedDateError,commit). - Claim: before, a native control flagged partial years with no message and dropped the rejection at blur. Verified against the base
NativeDateField.tsx. - Claim: unreadable text shows nothing while typing, and Enter or blur keeps it with "Invalid date",
aria-invalidand one announcement. Verified (useTypedDate.ts:147-152,:688-701; DateInput rejected-entry tests). - Claim: the message replaces a caller
status, and a callererrorwithonEntryErrorChangewins. Verified on the typed field (useTypedDate.ts:481-488); false on the native surfaces (see above). - Claim: a native refusal waits for Enter or blur, shows the out-of-range message and stays after the restore. Verified (
useTypedDate.ts:794-838,NativeDateField.tsx:573-590; native tests). - Claim: a shown rejection stays through a wrong or unfinished edit and clears when the entry is valid or empty. Verified (
useTypedDate.ts:434-451,:650-657; tests). - Claim: a disabled or busy field hides the rejection and shows it again once editable. Verified (
useTypedDate.ts:443; tests). - Claim: the posted form value does not change; a hidden input posts the committed date and the next Enter submits; kept unfinished, nonexistent or out-of-range text posts its typed text. Verified (
useTypedDate.ts:463-464,:745-746;DateInput.tsx:990,:1030-1037; form tests). - Claim: in DateTimeInput the native date message is the field status, and the time segment code is unchanged. Verified (
DateTimeInput.tsx:1082-1097). - Claim: no new prop, type, export, token or data attribute. Verified (the new hook stays in an internal module).
- Claim: 1189 authored lines. Verified.
- Claim: the test, typecheck, lint and mutation results in the description. Not re-run in this review.
- Files:
useTypedDate.ts,DateInput.tsx,NativeDateSegment.tsx, the five test files,en.jsonand the four records are clear;NativeDateField.tsx,DateTimeInput.tsxand the two.doc.mjsfiles have finding 1; the changeset has finding 2;useTypedDate.ts:773has an optional comment nit.
…ed native date With `onEntryErrorChange`, a caller `error` status with a message now shows in place of a refused native date's own message, as it does for typed text. `aria-invalid` stays set while the rejection stands, and when the caller's message does not change, the field's alert announces it once. DateInput passes whether the callback is set to the native field, and DateTimeInput's native date segment follows the same rule. The changeset limits the WCAG claim to a standalone field; inside an InputGroup a rejection sets `aria-invalid` and is announced.
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet; CI, Lint and the CLI smoke test are still running.
Both points from the last review are fixed. A refused native date now keeps a caller's error status message when onEntryErrorChange is set, with aria-invalid still on and a test on each surface, and the changeset now limits the WCAG claim to a standalone field. Next: let CI finish, and record an engineering owner's /approve-spec for this head so the spec-owner check can pass for the record edits.
Claims and files checked
- Claim: before, unreadable date text was flagged on each keystroke with no visible message and reverted at commit. Verified in the base
typedDateErrorgate andcommit(). - Claim: now nothing shows while typing, and Enter or blur keeps the text with "Invalid date" as the error status,
aria-invalidand one announcement. Verified (useTypedDate.ts:147-152,:688-701; test "shows nothing for unreadable text while typing, and every signal together on %s"). - Claim: a standalone field meets WCAG 1.4.1 and 3.3.1, and inside an InputGroup the rejection sets
aria-invalidand is announced. Verified (InputGroup tests inDateInput.test.tsxandNativeDateField.test.tsx). - Claim: the field's message replaces a caller
status, and withonEntryErrorChangea callererrorstatus with a message wins, native included. Verified (useTypedDate.ts:481-488,:850-886; native tests in both components). - Claim: a native refusal waits for Enter or blur, shows the range message, and stays after the restore until an accepted date or an empty control. Verified (
useTypedDate.ts:808-893;NativeDateField.test.tsx"DateInput native rejected entries"). - Claim: a shown rejection stays through an edit that leaves the entry wrong or unfinished and clears once valid or empty. Verified (
useTypedDate.ts:650-657; "keeps a shown rejection through an edit…"). - Claim: what a form posts does not change; a hidden input posts the committed date while unreadable text is kept, and the next Enter submits. Verified (
DateInput.tsx:990,:1030-1037;DateTimeInput.tsx:1854,:1892-1899;FormDatatests). - Claim: a disabled or busy field hides the rejection and shows it again once editable. Verified (
useTypedDate.ts:443,:842-843; lock tests). - Claim: in DateTimeInput the date message is the field status and the time segment's code is unchanged. Verified (
DateTimeInput.tsx:1094-1096; test "shows the date message when both segments hold a rejection"). - Claim: the native field only reads whether
onEntryErrorChangeis set and never calls it. Verified: DateInput forwards the callback (DateInput.tsx:1194) andNativeDateField.tsx:365reads only whether it is set. - Claim: no new prop, type, export, token or data attribute. Verified against the package
exportsmap and the diff. - Claim: 1334 authored lines. Verified.
- Claims: the test, lint, typecheck and mutation results. Left to CI, which is running them now.
- Files:
useTypedDate.ts,NativeDateField.tsx,DateInput.tsx,DateTimeInput.tsxandNativeDateSegment.tsx: clear. - Files:
DateInput.test.tsx,DateInput.calendar.test.tsx,NativeDateField.test.tsx,DateTimeInput.test.tsxandNativePickerSegments.test.tsx: clear. - Files: the DateInput, DateTimeInput, input-fields and rejected-entry records: clear (gap notes removed, test names added, every named test exists).
- Files:
DateInput.doc.mjs,DateTimeInput.doc.mjs,locales/en.jsonand the changeset: clear.
…before it reads the rejection
There was a problem hiding this comment.
Changes requested. The code follows the DateInput, DateTimeInput and rejected-entry records, and the audit change makes CI's DateInput audit pass on this head. Two points in the description need an update before approval:
- Newly live check: the rejected-entry record (
spec:AST-118), which became current after the last review, asks for a real-browser check of the partial years a native date control reports while the year is typed, of the native restore at blur, and of blur and Enter committing on the typed surfaces, and the description lists these as not run, so please run them and state each result (browser and version, device, head, outcome); CI's Chromium audit already covers Enter on DateInput's typed field. - The size transcript in the description says 1334 authored lines, but this head has 1345 after the audit commit, so please rerun the size check or correct the count.
Non-blocking: the audit's typed-invalid check accepts any described text (DateInputAudit.a11y.chromium.spec.ts:486-487), and DateInput.test.tsx:209 is still named for an alert it now asserts stays empty.
Claims and files checked
- Claim: before, unreadable date text was flagged on each keystroke with no visible message and reverted at commit, and a native control flagged each partial year and dropped its rejection at blur. Verified in the base code the diff removes.
- Claim: now nothing shows while typing, and Enter or blur keeps the text with "Invalid date" as the error status,
aria-invalidand one announcement. Verified (useTypedDate.ts:148,:689; test "shows nothing for unreadable text while typing, and every signal together on %s"). - Claim: the field's message replaces a caller
status, and withonEntryErrorChangea callererrorstatus with a message wins, native included. Verified (useTypedDate.ts:481,:850,:883; native tests on both components). - Claim: a native refusal waits for Enter or blur, shows the range message, and stays after the restore until an accepted date or an empty control. Verified in jsdom (
useTypedDate.ts:808-891; "keeps the rejection shown after blur restores the committed date"); not shown in a real browser. - Claim: a shown rejection stays through an edit that leaves the entry wrong or unfinished and clears once valid or empty. Verified (
useTypedDate.ts:652; edit tests). - Claim: what a form posts does not change; a hidden input posts the committed date while unreadable text is kept, and the next Enter submits. Verified (
DateInput.tsx:990,:1030-1037;DateTimeInput.tsx:1854,:1892-1899;FormDatatests). - Claim: a disabled or busy field hides the rejection and shows it again once editable. Verified (lock tests, typed and native).
- Claim: in DateTimeInput the date message is the field status and the time segment's code is unchanged. Verified (
DateTimeInput.tsx:1094; diff). - Claim: the native field only reads whether
onEntryErrorChangeis set and never calls it. Verified in substance: DateInput forwards the callback (DateInput.tsx:1194), andNativeDateField.tsx:365reads only whether it is set. - Claim: no new prop, type, export, token or data attribute. Verified against the package exports and CI's generated API changes.
- Claim: the audit's typed-invalid state presses Enter and the audit passes 73 tests. Verified by CI on this head.
- Claim: 1334 authored lines. False at this head (1345).
- Claim: real-browser checks were not run. True; see the first finding.
- Claims: the unit-test, lint, typecheck and mutation results. Not re-run here; CI's test jobs were still running.
- Files:
useTypedDate.ts,NativeDateField.tsx,DateInput.tsx,DateTimeInput.tsx,NativeDateSegment.tsx: clear. - Files:
DateInput.test.tsx(test-name note),DateInput.calendar.test.tsx,NativeDateField.test.tsx,DateTimeInput.test.tsx,NativePickerSegments.test.tsx: clear. - Files:
DateInputAudit.a11y.chromium.spec.ts: clear, with the non-blocking assertion note. - Files: the DateInput, DateTimeInput, input-fields and rejected-entry records: clear (gap lines removed, every named test exists).
- Files:
DateInput.doc.mjs,DateTimeInput.doc.mjs,locales/en.jsonand the changeset: clear.
…rowsers A Storybook interaction spec covers both components in Chromium, Firefox, and WebKit on a desktop page with a fine pointer: - A native date control shows no rejection while the year is typed, including each partial year the control reports, Enter shows the rejection, and a press outside restores the committed date and keeps the message. Playwright's Linux WebKit date control takes no typed digits, so WebKit skips these cases. - On the typed surfaces, text that is not a date shows nothing while it is typed, and Enter or a press outside keeps it with "Invalid date" in its description and `aria-invalid` set. The DateInput audit's typed-invalid state now requires the unreadable-date message in the field's description, and the jsdom case that asserts an empty alert is named for what it checks. The DateInput and DateTimeInput records list the spec.
There was a problem hiding this comment.
Approved pending CI: the test, typecheck and WebKit interaction jobs had not finished on this head at review time. The new real-browser spec covers native partial years, the native restore at blur, and Enter and blur on both typed surfaces; it passes on this head in Chromium and Firefox and fails on the base. Two optional follow-ups:
- The real-browser table in the description names head
57d7b33, which is not a commit of this pull request; the results hold on this head, so point the reference here. docs/specs/components/DateTimeInput/DateTimeInput.spec.mdline 337 still says no real-browser run drives the DateTimeInput date segment, which the new spec now does for rejected entries; narrow that gap to the calendar cases.
Claims and files checked
- Claim: before, unreadable date text was flagged and announced on each keystroke with no visible message and reverted at commit, and a native control flagged each partial year and dropped its rejection at blur. Verified in the base code and on a Storybook built from the base.
- Claim: now nothing shows while typing, and Enter or blur keeps the text with "Invalid date" as the error status,
aria-invalidand one announcement. Verified (useTypedDate.ts:147-152,:688-701; jsdom suites; real Chromium and Firefox). - Claim: the field's message replaces a caller
status, and withonEntryErrorChangea callererrorstatus with a message wins, on typed and native surfaces. Verified (useTypedDate.ts:481-488,:850-886; tests on both components). - Claim: a native refusal waits for Enter or blur, shows the range message, and stays after the restore until an accepted date or an empty control. Verified in jsdom and in real Chromium and Firefox.
- Claim: a shown rejection stays through an edit that leaves the entry wrong or unfinished, and a changed message is announced once. Verified (
useTypedDate.ts:652-657; edit tests). - Claim: what a form posts does not change; a hidden input posts the committed date while unreadable text is kept, and the next Enter submits. Verified (
DateInput.tsx:1030-1037,DateTimeInput.tsx:1892-1899;FormDatatests). - Claim: a disabled or busy field hides the rejection and shows it again once editable. Verified (lock tests, typed and native).
- Claim: in DateTimeInput the date message is the field status and the time segment's code is unchanged. Verified (
DateTimeInput.tsx:1094-1096; diff). - Claim: the native field only learns whether
onEntryErrorChangeis set and never calls it. Verified in substance: DateInput forwards the callback and the native field reads only whether it is set. - Claim: no new prop, type, export, token or data attribute. Verified with the repository's API report over builds of both trees, and CI's generated API changes.
- Claim: the audit's typed-invalid state presses Enter and requires "Invalid date" in the description; 73 audit tests pass. Verified in code and by CI.
- Claim: 1495 authored lines. Verified.
- Claim: the real-browser checks pass in Chromium and Firefox, with WebKit typed cases passing and native cases skipped. Chromium and Firefox verified on this head, and the same cases fail on the base; WebKit not re-run here.
- Claims: the unit-test, typecheck, lint, formatting, knowledge and changeset transcripts. DateInput and DateTimeInput suites (1096 tests), typecheck, lint, formatting, knowledge and changeset checks re-run here and clean; the full core suite was still running in CI.
- Claim: the writing rubric results. Verified: the record edits remove date gap lines and name tests; the time segment keeps its gap.
- Files:
useTypedDate.ts,NativeDateField.tsx,DateInput.tsx,DateTimeInput.tsx,NativeDateSegment.tsx: clear. - Files:
DateInput.test.tsx,DateInput.calendar.test.tsx,NativeDateField.test.tsx,DateTimeInput.test.tsx,NativePickerSegments.test.tsx: clear. - Files:
DateInputRejectedEntry.interaction.browser.spec.ts,DateInputAudit.a11y.chromium.spec.ts: clear. - Files: the DateInput, rejected-entry and input-fields records: clear; the DateTimeInput record: clear, with the optional note above.
- Files:
DateInput.doc.mjs,DateTimeInput.doc.mjs,locales/en.jsonand the changeset: clear.
There was a problem hiding this comment.
Changes requested. The component code follows the DateInput, DateTimeInput and rejected-entry records, and the new real-browser spec passes on this head in Chromium and Firefox and fails on the base; one CI failure needs a fix:
- Found by CI:
.github/scripts/playwright-legs.test.mjs("runs every record-named proof in another folder when its component changes") fails on this head because the DateTimeInput record now listsDateInputRejectedEntry.interaction.browser.spec.tsfrom the DateInput folder while.github/interaction-selection.jsonhas no edge frompackages/core/src/DateTimeInput/to it, so please add that edge.
Optional:
- The real-browser table in the description names head
57d7b33, which is not a commit of this pull request; the results hold on this head, so point the reference here. docs/specs/components/DateTimeInput/DateTimeInput.spec.mdline 337 still says no real-browser run drives the DateTimeInput date segment, which the new spec now does for rejected entries; narrow that gap to the calendar cases.
Claims and files checked
- Claim: before, unreadable date text was flagged and announced on each keystroke with no visible message and reverted at commit, and a native control flagged each partial year and dropped its rejection at blur. Verified in the base code and on a Storybook built from the base.
- Claim: now nothing shows while typing, and Enter or blur keeps the text with "Invalid date" as the error status,
aria-invalidand one announcement. Verified (useTypedDate.ts:147-152,:688-701; jsdom suites; real Chromium and Firefox). - Claim: the field's message replaces a caller
status, and withonEntryErrorChangea callererrorstatus with a message wins, on typed and native surfaces. Verified (useTypedDate.ts:481-488,:850-886; tests on both components). - Claim: a native refusal waits for Enter or blur, shows the range message, and stays after the restore until an accepted date or an empty control. Verified in jsdom and in real Chromium and Firefox.
- Claim: a shown rejection stays through an edit that leaves the entry wrong or unfinished, and a changed message is announced once. Verified (
useTypedDate.ts:652-657; edit tests). - Claim: what a form posts does not change; a hidden input posts the committed date while unreadable text is kept, and the next Enter submits. Verified (
DateInput.tsx:1030-1037,DateTimeInput.tsx:1892-1899;FormDatatests). - Claim: a disabled or busy field hides the rejection and shows it again once editable. Verified (lock tests, typed and native).
- Claim: in DateTimeInput the date message is the field status and the time segment's code is unchanged. Verified (
DateTimeInput.tsx:1094-1096; diff). - Claim: the native field only learns whether
onEntryErrorChangeis set and never calls it. Verified in substance: DateInput forwards the callback and the native field reads only whether it is set. - Claim: no new prop, type, export, token or data attribute. Verified with the repository's API report over builds of both trees, and CI's generated API changes.
- Claim: the audit's typed-invalid state presses Enter and requires "Invalid date" in the description; 73 audit tests pass. Verified in code and by CI.
- Claim: 1495 authored lines. Verified.
- Claim: the real-browser checks pass in Chromium and Firefox, with WebKit typed cases passing and native cases skipped. Chromium and Firefox verified on this head, and the same cases fail on the base; CI's WebKit lane passes the four typed cases and skips the two native ones.
- Claims: the unit-test, typecheck, lint, formatting, knowledge and changeset transcripts. DateInput and DateTimeInput suites (1096 tests), typecheck, lint, formatting, knowledge and changeset checks re-run and clean; CI's repository-script tests fail on the CI-selection test above, which the description's transcripts do not cover.
- Claim: the writing rubric results. Verified: the record edits remove date gap lines and name tests; the time segment keeps its gap.
- Files:
useTypedDate.ts,NativeDateField.tsx,DateInput.tsx,DateTimeInput.tsx,NativeDateSegment.tsx: clear. - Files:
DateInput.test.tsx,DateInput.calendar.test.tsx,NativeDateField.test.tsx,DateTimeInput.test.tsx,NativePickerSegments.test.tsx: clear. - Files:
DateInputRejectedEntry.interaction.browser.spec.ts,DateInputAudit.a11y.chromium.spec.ts: clear. - Files: the DateInput, rejected-entry and input-fields records: clear; the DateTimeInput record: the CI-selection finding above (its new
verified_byentry) and the optional line-337 note. - Files:
DateInput.doc.mjs,DateTimeInput.doc.mjs,locales/en.jsonand the changeset: clear.
…er proof; narrow the DateTimeInput evidence gap
There was a problem hiding this comment.
Approved. Every CI check on this head has finished green.
The fix follows the DateInput, DateTimeInput and rejected-entry records: unreadable date text and native refusals are now revealed at Enter or blur, kept, and shown as the field's error, and the new real-browser spec passes in CI's Chromium and WebKit lanes. The interaction-selection edge that failed CI at the previous head is in place, and playwright-legs.test.mjs passes on this head. The repository's spec gate still waits for an engineering owner's /approve-spec on this head for the record edits.
- Optional: the description's real-browser table names a head commit that is not part of this pull request; restating it against this head keeps the evidence traceable.
Claims and files checked
- Claim: Typed text that is not a date shows nothing while typing; Enter or blur keeps it and shows "Invalid date" as the field's error, with
aria-invalidand one announcement: verified (useTypedDate.ts:147-165,:688-701; DateInput rejected-entry tests; Chromium capture). - Claim: That message replaces a caller
status; withonEntryErrorChangea caller error message wins, and the callback reports unreadable text at the commit: verified (useTypedDate.ts:481-488; status and callback tests). - Claim: A shown rejection stays through a wrong or unfinished edit, a changed message is announced once, and an accepted date, an empty field, a new
valueor a pick clears it: verified (useTypedDate.ts:434-451,:596-605,:652-657; edit, pick and announcement tests). - Claim: A disabled or busy field hides the rejection, keeps the text, and shows it again once editable: verified (
useTypedDate.ts:443; lock tests on both surfaces). - Claim: What a form posts does not change: a hidden input posts the committed date while kept unreadable text stays, the text input regains
nameafter an edit, a newvalueor a pick, and the next Enter submits: verified (useTypedDate.ts:463-464,:745-746;DateInput.tsx:905,:990,:1030-1037;DateTimeInput.tsx:1854,:1892-1899; form tests). - Claim: Kept unfinished, nonexistent or out-of-range text still posts its typed text: verified ("posts kept %s text from the text input"; DateTimeInput form case).
- Claim: A native refusal waits for Enter or blur, shows the out-of-range or available-date message as the field status under the same
statusrules, and stays after blur restores the committed date until an accepted date or an empty control: verified (useTypedDate.ts:808-893; NativeDateField and NativePickerSegments tests; Chromium capture; CI interaction lane). - Claim: With
onEntryErrorChange, a caller error message shows in place of a native refusal,aria-invalidstays set, and an unchanged message is announced once through the alert: verified (useTypedDate.ts:850-886; native callback tests on both components). - Claim: DateInput hands the native field only whether the callback is set, and the native field never calls it: verified in effect (the native field reads
onEntryErrorChange != nullonly,NativeDateField.tsx:365). - Claim: In DateTimeInput the native date segment follows the same rules and its status is the field status; with both segments rejected the date message shows and the time segment keeps its own
aria-invalidand alert, with its code paths unchanged: verified (DateTimeInput.tsx:1082-1096,:1803; "shows the date message when both segments hold a rejection"). - Claim: No new prop, type, export, token or data attribute: verified (generator: 0 public API rows; no
data-*added). - Claim: The native rejection state lives in the shared
useTypedDatemodule the rejected-entry record applies to: verified (the record's path list namesuseTypedDate.ts). - Claim: Before the change, unreadable text was flagged and announced before any commit and reverted at blur, and a native refusal was flagged at once and cleared at blur: verified (base tests the diff replaces; base Chromium captures).
- Claim: The interaction selection now runs the browser spec for a DateTimeInput change, and the selection tests pass: verified (CI:
playwright-legs.test.mjs80/80 at this head). - Claim: The DateInput audit's typed-invalid state presses Enter and requires "Invalid date" in the described text: verified (
DateInputAudit.a11y.chromium.spec.ts). - Claim: Unit, type, lint, format, knowledge, changeset and i18n checks pass: verified where rerun or run by CI at this head (local vitest over the date suites: 1873 passed; CI typecheck, lint and validate green); the author's exact counts were not rerun.
- Claim: Each mutation in the tables fails at least one test: spot-checked, both caught (unreadable text flagged while typing; native blur dropping the rejection: 6 NativeDateField tests fail).
- Claim: Real-browser checks pass in Chromium and Firefox, with WebKit typed only: verified for Chromium and WebKit by CI at this head; the head commit the table names is not part of this pull request.
- Claim: The change is 1529 authored lines and merges cleanly: verified (numstat; clean merge into the current main).
- Claim: Changeset: a patch fix naming the old and new behaviour and WCAG 2.2 1.4.1 and 3.3.1, with InputGroup fields announced and marked invalid: verified (
.changeset/date-input-rejected-entry.md; InputGroup tests). .changeset/date-input-rejected-entry.md: clear.github/interaction-selection.json: cleardocs/families/input-fields.md: cleardocs/specs/AST-118-rejected-entry-feedback/spec.md: cleardocs/specs/components/DateInput/DateInput.spec.md: cleardocs/specs/components/DateTimeInput/DateTimeInput.spec.md: clearpackages/core/locales/en.json: clearpackages/core/src/DateInput/DateInput.calendar.test.tsx: clearpackages/core/src/DateInput/DateInput.doc.mjs: clearpackages/core/src/DateInput/DateInput.test.tsx: clearpackages/core/src/DateInput/DateInput.tsx: clearpackages/core/src/DateInput/NativeDateField.test.tsx: clearpackages/core/src/DateInput/NativeDateField.tsx: clearpackages/core/src/DateInput/__tests__/DateInputAudit.a11y.chromium.spec.ts: clearpackages/core/src/DateInput/__tests__/DateInputRejectedEntry.interaction.browser.spec.ts: clearpackages/core/src/DateInput/useTypedDate.ts: clearpackages/core/src/DateTimeInput/DateTimeInput.doc.mjs: clearpackages/core/src/DateTimeInput/DateTimeInput.test.tsx: clearpackages/core/src/DateTimeInput/DateTimeInput.tsx: clearpackages/core/src/DateTimeInput/NativeDateSegment.tsx: clearpackages/core/src/DateTimeInput/NativePickerSegments.test.tsx: clear
|
/approve-spec ee3f45a |




































User impact
People who type a date that the field cannot read, or pick a date the field refuses in a native date control, could not tell what went wrong or keep their entry:
-. No message showed on screen; the text only turned secondary. Enter or blur then reverted the text with no message.0002-05-10), showed no message, and dropped the rejection when it restored the committed date at blur.This fails WCAG 2.2 1.4.1 (Use of Color) and 3.3.1 (Error Identification), both Level A, for DateInput and the date segment of DateTimeInput.
Problem and solution fit
The fix changes when the field reveals a rejection and how long it keeps it. It does not change the committed value,
onChange, or what a form posts.Expected behavior and authority
spec:AST-118FR1–FR7 and FR10, DEC-8, DEC-9, DEC-13 (rejected entry feedback).component:DateInputFR20, FR25, AR3;component:DateTimeInputFR8, FR11, FR16, AR5;family:input-fieldsFR15.spec:AST-017FR53: an accessibility behavior fix ships as a patch.Smallest restoration
aria-invalidand one announcement.status, as the field's other rejections already do. WithonEntryErrorChange, the existing rules apply: a callererrorstatus with a message wins, and the callback reports unreadable text at the Enter or blur that reveals it.value, or a calendar pick clears it.nameas the field shows it. The text input carries nonameuntil the person edits the text or a newvalueor pick replaces it. That kept text does not hold Enter back, so the next Enter submits the form. Kept unfinished, nonexistent, or out-of-range text still posts its typed text.statusrules as typed text: it replaces a callerstatus, except that withonEntryErrorChangea callererrorstatus with a message shows in its place,aria-invalidstays set, and when that message does not change the field's alert announces it once. Awarningorsuccessstatus never replaces it. Blur restores the committed date and the rejection stays shown, until the control reports a date the field accepts or nothing. DateInput passes only whetheronEntryErrorChangeis set to the native field, which never calls it. In DateTimeInput, the native date segment follows the same rules and its status is the field status.aria-invalidon its input and announces through its alert. The time segment's code paths are unchanged.data-*attribute. The native rejection state lives besideuseTypedDateFieldin the existing internaluseTypedDatemodule, which DateInput and DateTimeInput share and whichspec:AST-118applies to.Evidence
origin/main, entering13/45/2024setsaria-invalidand fills the visually hidden alert before any commit, with no status shown; blur restores the committed text. A native control set to2026-03-22with a Sunday constraint is marked invalid at once, and blur clears it.onEntryErrorChangesuites pass with unchanged expectations except where unreadable text now reports at commit.Scope
Components: DateInput, DateTimeInput
Tests whose expectations the records change were updated: unreadable text is kept and shown at commit rather than reverted or announced on each keystroke, and a native rejection waits for Enter or blur and stays after the restore, with the out-of-range message in place of "Invalid date".
The
family:input-fieldsFR15 verification row staysTBD (gap), andcomponent:DateTimeInputFR16 keeps aTBD (gap)for the time segment, because TimeInput, NumberInput, and the time segment are outside this change.Testing
.github/interaction-selection.jsongains the edge frompackages/core/src/DateTimeInput/toDateInputRejectedEntry.interaction.browser.spec.ts, which the DateTimeInput record names;.github/scripts/playwright-legs.test.mjs: 80 passed.The DateInput a11y audit's
typed-invalidstate now presses Enter after typing, since unreadable text is revealed at commit; it requires the unreadable-date message ("Invalid date") in the field'saria-describedbytext.playwright test --config playwright.config.ts --project=chromium DateInputAudit.a11y.chromium.spec.ts: 73 passed.Mutation checks. Each row breaks one behavior once and runs the DateInput, DateInput calendar, NativeDateField, DateTimeInput, and NativePickerSegments suites (487 tests):
namenameMutations for the caller-status rule on native surfaces, run against the NativeDateField, DateTimeInput, and DateInput suites (411 tests):
onEntryErrorChangebefore the native fieldaria-invalidReal-browser checks
DateInputRejectedEntry.interaction.browser.spec.ts(interaction lane, Storybook storiescore-dateinput--with-min-maxandcore-datetimeinput--with-min-maxwithpresentation: native, andcore-dateinput--defaultandcore-datetimeinput--defaultwithpresentation: popover; desktop page 1024 × 768, fine pointer, no touch). Head57d7b33a40e3ac321267df55f13aa9933de678af; the Storybook was built from the same component source. Host: Linux x86-64 for Chromium and Firefox; WebKit ran in the official Playwright image (Ubuntu 24.04) throughinternal/interaction-harness/scripts/webkit-container.mjs. Playwright 1.61.1.0002-02-01,0020-02-01,0202-02-01, then2026-02-01while2026was typed, and0262-02-01,2620-02-01,6202-02-01,2027-02-01while2027was typed; noaria-invalidor message after any key. Enter setaria-invalidand described the field with "Enter a date from January 15, 2026 to February 15, 2026" (DateTimeInput: "…from March 15, 2026 to March 15, 2026").2026-02-01(2026-03-15) andaria-invalidand the message stayed.tomorrowishwas typed; after Enter, and after a press outside, the text stayed,aria-invalidwas set, and the description included "Invalid date".Results: Chromium 6 passed; Firefox 6 passed (an ad hoc Firefox project over the same spec, since the interaction config defines Chromium and WebKit); WebKit 4 passed, 2 skipped. Mutation check: with the native refusal shown at once and unreadable text flagged while typed, all 6 Chromium cases failed, and they passed again on the restored source.
Not run: Enter submitting a form after kept unreadable text in a real browser. The jsdom suites assert that the second Enter is not prevented and what
FormDataposts.Writing rubric results
Records touched:
component:DateInput,component:DateTimeInput,family:input-fields,spec:AST-118.