Skip to content

feat(DateInput, DateTimeInput, TimeInput, FormLayout): entryErrorBehavior and a form default - #11485

Merged
nynexman4464 merged 1 commit into
mainfrom
nynexman4464/feat/entry-error-behavior
Nov 13, 2026
Merged

nynexman4464 merged 1 commit into
mainfrom
nynexman4464/feat/entry-error-behavior

Conversation

@nynexman4464

@nynexman4464 nynexman4464 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Stack: #11485 → #11492

User need

A form that checks its fields on blur shows nothing while a person types into a text field, but DateInput, DateTimeInput, and TimeInput flag some of their own rejections mid-typing: a date the calendar does not have (02/31/2026) or one outside min/max as soon as the typed date is complete, and a complete time outside the range. In that form, the date and time fields light up red and announce an error while the person is still typing, and every other field waits for blur. The caller cannot hold those signals back: the rejection belongs to the field, and wrapping it cannot delay its aria-invalid, its message, or its live-region announcement. Builders need one setting that holds a field's own rejections to Enter or blur, for one field or for a whole form, without losing early feedback in forms that want it.

Problem and solution fit

  • entryErrorBehavior on DateInput, DateTimeInput, and TimeInput chooses the moment a field reveals its own rejection: 'complete' (the default, each field's shipped timing) or 'blur-or-enter'.
  • Under 'blur-or-enter', typing reveals nothing. Enter or blur reveals the entry's current rejection with every signal at once: the message, aria-invalid, the invalid text styling, one announcement, and the onEntryErrorChange report, so a caller error status driven by that report appears at the same commit. An edit that makes the entry valid or empty clears at once. An edit that leaves it wrong keeps the shown error without announcing it again, until the next commit. A native time control's out-of-range edit waits for Enter or blur the same way.
  • defaultEntryErrorBehavior on FormLayout sets it for a form through the layout context that already carries defaultOptionality. A field's own prop wins; a nested FormLayout replaces the default (unset there means 'complete'); content in a layer such as a Dialog starts without it.
  • PowerSearch value editors and Table filter editors pass 'complete' explicitly, so a FormLayout around them does not change their timing.
  • EntryErrorBehavior is exported from FormLayout, DateInput, DateTimeInput, and TimeInput.

TimeInput is included because DateTimeInput's time segment shares TimeInput's typed-time hook and native time control; the change there is the same code path. NumberInput and Pagination's page input are left for a follow-up pull request. NumberInput already reveals every rejection only at commit, so both values behave alike there; the records keep that one gap line.

Current specification

  • spec:AST-117 FR1–FR7, DEC-1–DEC-6 (current, approved).
  • Projections: family:input-fields FR14; component:FormLayout FR4, FR7, ORD4; component:DateInput FR24; component:DateTimeInput FR15; component:TimeInput FR13.
  • Naming follows architecture:public-component-api INV2 (<thing>Behavior) and INV3 (the default is the shipped behavior), as AST-117 DEC-3 records.

Behavior changes by clause: the reveal moment under 'blur-or-enter' (AST-117 FR4, AR1, AR2), clearing and keeping (FR5), locked fields (FR6, no change), precedence and layers (FR2), compositions (FR7). With neither prop set, nothing changes (FR3).

Three AST-117 record edits for the spec owner to check, beyond closing gaps:

  • Compatibility said 'blur-or-enter' "makes Enter a commit for TimeInput and for DateTimeInput's time segment, which have no Enter commit by default". Both already commit typed text on Enter under the default (AST-118 FR9). The sentence now says what the value adds there: Enter reveals a held native time rejection. The matching "FR4 gap" line is removed for the same reason.
  • A new "FR6 gap" line: a busy TimeInput (isLoading or a pending changeAction) stays editable but reveals no rejection of its own until it is idle. This is the shipped AST-118 behavior and this change does not alter it; TimeInput's record lists it under Current-state impact too.
  • The remaining FR1/FR2 gap is NumberInput, which takes no prop yet.

Public delta and caller burden

// Before: a form that checks fields on blur cannot hold the date field's own error.
<FormLayout>
  <DateInput label="Start" value={start} onChange={setStart} max="2026-12-31" />
</FormLayout>

// After: the field's own rejection waits for Enter or blur.
<FormLayout defaultEntryErrorBehavior="blur-or-enter">
  <DateInput label="Start" value={start} onChange={setStart} max="2026-12-31" />
  <TimeInput
    label="Arrival"
    value={arrival}
    onChange={setArrival}
    entryErrorBehavior="complete" // this field's own prop wins
  />
</FormLayout>
  • New optional props: entryErrorBehavior?: 'complete' | 'blur-or-enter' on DateInput, DateTimeInput, and TimeInput; defaultEntryErrorBehavior?: EntryErrorBehavior on FormLayout. New type EntryErrorBehavior. FormLayoutContext's value gains an optional defaultEntryErrorBehavior.
  • Default: the nearest FormLayout's default, else 'complete'. Usage that sets neither is unchanged (additive, spec:AST-017 FR5).
  • It sets when a field's own entry error shows, not when validation runs, and it is not React Aria's validationBehavior. It never changes a caller status, isRequired, or form-library rules.
  • A date the native date control refuses already waits for Enter or blur under both values.
  • Caller decisions: one, which moment the form wants. Nothing else to configure.
  • Theming: none. Accessibility: under 'blur-or-enter' the announcement moves to the commit and is made once; a rejected entry kept at commit is still announced.

Design and alternatives

  • One resolution hook, Field/useEntryErrorBehavior (the field prop, else the FormLayout default, else 'complete'), shared by the three members. The family record's Shared owner section names it.
  • The gate sits at each member's one reveal rule, not in the shared report hook: typedDateError in useTypedDate (DateInput and DateTimeInput's date segment) and the fresh-rejection rule in useTypedTime (TimeInput and DateTimeInput's time segment). Under 'blur-or-enter' a complete value rejection no longer counts as revealed until a commit. useEntryErrorReport then shows, announces, and reports exactly what the member reveals, so the status, alert, and report move together without a second copy of the timing logic. The report hook cannot gate on its own: it does not know when an entry is complete or committed.
  • A native time control's rejection is held in useTypedTime as 'held' and shown at a commit that NativeTimeSegment now reports on Enter and blur.
  • Alternatives rejected by the record: validationBehavior and validation-timing names (DEC-3), separate 'blur' and 'enter' values (DEC-3), commit timing as the only behavior (DEC-1), and following a form default inside filter editors (DEC-5).

Evidence

  • Default path: every existing DateInput, DateTimeInput, TimeInput, NativeDateField, and FormLayout suite passes unchanged. New cases assert, with no prop and with 'complete', that a complete nonexistent date and a complete out-of-range time still show while typing.
  • 'blur-or-enter', keystroke by keystroke: no status message, no aria-invalid, no invalid style, empty alert, no announcement, and no onEntryErrorChange call. At Enter and at blur: all of them at once, the report called once, one announcement after the live region settles.
  • Clearing and keeping: an edit to a valid date or to empty clears at once and reports null; a still-wrong edit keeps the shown message with no new report or announcement; the next commit reveals the current rejection; a calendar pick clears it; disabled and busy fields ignore Enter and blur, and a revealed rejection shows again once editable.
  • Native: a refused native date waits for Enter or blur under both values; a native time before the minimum waits for Enter or blur under 'blur-or-enter', stays through a still-wrong edit, and clears at once.
  • Precedence: no layout, unset, 'complete', 'blur-or-enter', field over form both ways, a nested layout with and without a value, a field in an inline Dialog opened in the form, and the context value itself. Type errors for other values.
  • Compositions: PowerSearch's date editors (date-only and date-time) and Table's inline date filter keep revealing a nonexistent date while typing inside FormLayout defaultEntryErrorBehavior="blur-or-enter".
  • Real browser (Chromium 149 headless on a built Storybook): DateInputRejectedEntry.interaction.browser.spec.ts gains four cases. In DateInput and in DateTimeInput's date segment under 'blur-or-enter', typing 02/31/2026 key by key shows no aria-invalid and no "Enter a real date" in the control's description; Enter, and a press outside the field, then show both. With the story arg set to 'complete' instead, all four fail at the last keystroke, so the arg reaches the component.
  • A held native time edit shows at once when the field switches to 'complete' while it waits.
  • Mutation checks: 26 one-line mutations of the new behavior (precedence, nested reset, context value, both reveal gates, the typed-date report, kept and cleared rejections, native hold, keep, and commit, Enter and blur commits in the native time control, each member dropping the resolved value, both compositions following the form, a held native edit ignoring a switch to 'complete'). 25 fail a test. The survivor removes the valid-or-empty test from the kept-text condition in useTypedDate; it is equivalent, because the shown rejection already drops kept text for a valid or empty entry, and the existing report sync sends null right after that render.

Scope

Components: DateInput, DateTimeInput, TimeInput, FormLayout, Field (internal hook), PowerSearch (value editors), Table (filter editors)

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

Node 24.22.1, pnpm 11.10.0. Head b1b9a2a364 on 8e4cc9efa8; every run below is at that head except the mutation run: its first 25 mutations ran on the same change before the last review fixes (records, JSDoc, the held-edit switch) and a rebase that adds two CLI-only commits, and the 26th ran on the final code.

$ pnpm exec vitest run --project ui packages/core/src/{DateInput,DateTimeInput,DateRangeInput,TimeInput,PowerSearch,FormLayout,Field,Pagination} packages/core/src/Table/plugins/filtering
 Test Files  67 passed (67)
      Tests  2402 passed (2402)

$ pnpm exec vitest run --project ui --project node packages/core --maxWorkers=48
 Test Files  852 passed (852)
      Tests  23106 passed (23106)
(an earlier full run at the previous head failed once in useTableColumnsVirtualization.test.tsx, "keeps a focused cell row and column when both scroll away, and the same element when they return"; that file passed 37/37 alone three times and in this run)

$ pnpm exec tsc --noEmit -p packages/core
(0 errors)

$ ASTRYX_STRICT_LINT=1 pnpm exec eslint <23 changed .ts/.tsx files>
(0 errors, 0 warnings; the four .doc.mjs files are outside the lint config)

$ pnpm exec prettier --check <34 changed files>
All matched files use Prettier code style!

$ pnpm check:knowledge
Knowledge templates and records are aligned.

$ pnpm check:changesets
✓ check:changesets — 152 changeset(s) valid (0.x: [breaking] -> minor, [experimental] and other categories -> patch); main declares 0.7.16 (patch plan)

$ node scripts/release/changeset-coverage.mjs pr --base origin/main --head HEAD --released v0.7.15
✓ Changeset coverage — ships to @astryxdesign/core, each named; released CLI JSON ids checked against v0.7.15

$ node internal/eslint-plugin-astryx/no-comment-provenance.baseline.mjs --check
no-comment-provenance baseline is up to date.

$ pnpm review:pre
Authored lines: 1309 (guideline 2000; lockfiles, snapshots, and generated files excluded)
Merge into origin/main: clean
Findings in this change (0):
  none

$ pnpm storybook:build
$ pnpm exec playwright test --config playwright.interaction.config.ts --project=chromium packages/core/src/DateInput/__tests__/DateInputRejectedEntry.interaction.browser.spec.ts
  10 passed (10.0s)
  (the 4 new "under blur-or-enter" cases: 4 failed with the story arg set to 'complete')

Mutation run: 26 mutations, 25 killed, 1 equivalent (see Evidence), 7 test files per mutation.

Not run locally: the WebKit project of the interaction suite (the Linux host lacks WebKit's system libraries); CI runs it. Screen-reader passes for AR1–AR3 (spec:AST-009) are not part of this change; the live-region assertions above cover what jsdom and Chromium can observe.

Writing rubric results

Records touched: spec:AST-117, family:input-fields, component:DateInput, component:DateTimeInput, component:TimeInput, component:FormLayout.

  • R1 narration: none in the edited text. The new family bullet and gap lines state what the system does now in the present tense.
  • R2 research: none.
  • R3 evidence: four basis cells read "proposal"; each now names source and tests or context source and tests. Each "TBD (gap)" verification row now names its suites and test names.
  • R4 rejected alternatives: no new ones. AST-117 DEC-3 keeps its existing one-line Rejected: items.
  • R5 change references: none (searched # plus digits, /pull/, /issues/ in the changed lines).
  • R6 open questions: none answered here; FormLayout OQ1 is unrelated and unchanged.
  • R7 project status: one new gap line, "FR6 gap: a busy TimeInput … stays editable but reveals no rejection of its own until it is idle", in the required gap form. The "no member accepts entryErrorBehavior" gap lines in the four component records and the family record are removed or narrowed to the one observable gap left ("FR1, FR2 gap: NumberInput takes no entryErrorBehavior and reads no FormLayout default"). The AST-117 "FR4 gap" on Enter in TimeInput and DateTimeInput's time segment is removed because both commit on Enter today. Public-concept stability moves from "Proposed" to "Stable" in the four component records, and the family concept row from "proposed by" to "approved by".

…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'.
@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 13, 2026 7:22am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 13, 2026
@astracat-bot

astracat-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 13, 2026, 7:39 AM UTC

@nynexman4464

Copy link
Copy Markdown
Contributor Author

/approve-spec 5b3078b

@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI is still running on this head.

entryErrorBehavior on DateInput, DateTimeInput and TimeInput, and FormLayout's defaultEntryErrorBehavior, follow the entry error behavior spec: unset, each field keeps its current timing, and under 'blur-or-enter' the message, aria-invalid, invalid styling, announcement and onEntryErrorChange report wait for Enter or blur, which a real-browser check of DateInput, the typed TimeInput and the native time control confirms.

Non-blocking: the native time control's new Enter and blur commit (NativeTimeSegment.tsx) is covered only by jsdom tests; a TimeInput presentation="native" case in the interaction browser spec would keep it proved in Chromium and WebKit, as the spec's platform-support section asks.

Claims and files checked

Claims

  • The three fields take entryErrorBehavior and FormLayout takes defaultEntryErrorBehavior: verified (DateInput.tsx:407, DateTimeInput.tsx:565, TimeInput.tsx:429, FormLayout.tsx:138).
  • The prop sets when a field's own error shows, not when validation runs: verified (parsing still runs on every edit; only the reveal is gated, useTypedDate.ts:148, useTypedTime.ts:212-216).
  • 'complete', the default, keeps each field's current timing: verified (useEntryErrorBehavior.ts:33; existing suites pass unchanged; new unset and 'complete' cases).
  • 'blur-or-enter' holds the message, aria-invalid, styling, announcement and report until Enter or blur: verified (new keystroke cases in the DateInput, DateTimeInput and TimeInput tests; real-browser check).
  • An edit that makes the entry valid or empty clears the error at once: verified ("clears a revealed rejection and reports null at once" and the time suites).
  • An edit that leaves the entry wrong keeps the shown error without a new announcement until the next commit: verified ("keeps a revealed rejection through edits that stay wrong").
  • A field's own prop wins, a nested FormLayout replaces the default, and a Dialog opened from the form starts without it: verified (FormLayout.test.tsx precedence cases).
  • PowerSearch value editors and Table filter editors keep 'complete': verified (PowerSearchValueEditor.tsx:499, :570, :582, :635; useTableFiltering.tsx:747, :777; tests inside a 'blur-or-enter' FormLayout).
  • EntryErrorBehavior names the two values and is exported from FormLayout, DateInput, DateTimeInput and TimeInput: verified (FormLayoutContext.ts:57 and the four index.ts files).
  • A native time control's out-of-range edit waits for Enter or blur: verified (useTypedTime.ts:306-320, NativeTimeSegment.tsx:290-300; jsdom tests; real-browser check).
  • A date the native date control refuses already waits for Enter or blur under both values: verified (new NativeDateField.test.tsx case for both values).
  • DateTimeInput's time segment shares TimeInput's typed-time hook and native time control: verified (DateTimeInput.tsx:890, TimeInput.tsx:89).
  • TimeInput and DateTimeInput's time segment already commit typed text on Enter by default: verified (Enter handling in TimeInput.tsx on the base branch).
  • A busy TimeInput stays editable but reveals no rejection of its own until idle: verified (TimeInput.tsx:554, :597).
  • NumberInput already reveals rejections only at commit: verified against NumberInput's rejected-entry record clause; this change does not touch NumberInput.
  • Usage that sets neither prop is unchanged: verified (existing suites; base and head render the same after a commit).
  • The interaction browser spec gains four 'blur-or-enter' cases: verified in the diff; the DateInput case reproduces in a real browser.
  • The listed test, typecheck, lint, format, knowledge and changeset runs pass: the description names an earlier commit; at this head the changed test files (661 tests), typecheck, lint, format, knowledge and changeset checks pass.
  • 1,309 authored lines: verified.

Files

  • .changeset/entry-error-behavior.md: clear
  • docs/families/input-fields.md: clear
  • docs/specs/AST-117-validation-timing/spec.md: clear
  • docs/specs/components/DateInput/DateInput.spec.md: clear
  • docs/specs/components/DateTimeInput/DateTimeInput.spec.md: clear
  • docs/specs/components/FormLayout/FormLayout.spec.md: clear
  • docs/specs/components/TimeInput/TimeInput.spec.md: clear
  • packages/core/src/DateInput/DateInput.doc.mjs: clear
  • packages/core/src/DateInput/DateInput.test.tsx: clear
  • packages/core/src/DateInput/DateInput.tsx: clear
  • packages/core/src/DateInput/NativeDateField.test.tsx: clear
  • packages/core/src/DateInput/__tests__/DateInputRejectedEntry.interaction.browser.spec.ts: clear
  • packages/core/src/DateInput/index.ts: clear
  • packages/core/src/DateInput/useTypedDate.ts: clear
  • packages/core/src/DateTimeInput/DateTimeInput.doc.mjs: clear
  • packages/core/src/DateTimeInput/DateTimeInput.test.tsx: clear
  • packages/core/src/DateTimeInput/DateTimeInput.tsx: clear
  • packages/core/src/DateTimeInput/NativeTimeSegment.tsx: non-blocking note (no real-browser case for the new Enter and blur commit)
  • packages/core/src/DateTimeInput/index.ts: clear
  • packages/core/src/Field/useEntryErrorBehavior.ts: clear
  • packages/core/src/FormLayout/FormLayout.doc.mjs: clear
  • packages/core/src/FormLayout/FormLayout.test.tsx: clear
  • packages/core/src/FormLayout/FormLayout.tsx: clear
  • packages/core/src/FormLayout/FormLayoutContext.ts: clear
  • packages/core/src/FormLayout/index.ts: clear
  • packages/core/src/PowerSearch/PowerSearchValueEditor.test.tsx: clear
  • packages/core/src/PowerSearch/PowerSearchValueEditor.tsx: clear
  • packages/core/src/Table/plugins/filtering/useTableFiltering.test.tsx: clear
  • packages/core/src/Table/plugins/filtering/useTableFiltering.tsx: clear
  • packages/core/src/TimeInput/TimeInput.doc.mjs: clear
  • packages/core/src/TimeInput/TimeInput.test.tsx: clear
  • packages/core/src/TimeInput/TimeInput.tsx: clear
  • packages/core/src/TimeInput/index.ts: clear
  • packages/core/src/TimeInput/useTypedTime.ts: clear

Automated review (maintainer link)

onCommit();
}, [commitValue, nativeValue, isRejected, onCommit]);

const handleKeyDown = useCallback(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: this Enter commit, and the blur commit at line 290, are covered only by jsdom fireEvent tests. The entry error behavior spec's platform-support section asks for a real-browser check that Enter and blur commit on native surfaces. A TimeInput presentation="native" case in the interaction browser spec (a time before min: no aria-invalid while typed, then aria-invalid and the message at Enter and at blur) would keep this path proved in Chromium and WebKit.

This branch was successfully deployed

1 active deployment
Preview — 5b3078b3 Deployed Nov 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant