Repository navigation
fix(TimeInput, DateTimeInput): keep rejected time entries and show why - #11413
Conversation
…it, and report it A typed time is complete once it has its hours, both minute digits, both second digits when the field shows seconds, and, in 12-hour text, its day period unless the hour reads 0 or 13-23. Until then nothing is marked or announced. A complete time outside min or max shows at once; text that is not a time shows at Enter or blur. The rejected text stays in the field, and a standalone field shows the invalid-time message as its error status, with aria-invalid and one announcement. Inside an InputGroup the rejection sets aria-invalid and is announced through the field's alert. An edit that leaves the draft wrong keeps the shown rejection without a new announcement. Enter in TimeInput and in DateTimeInput's time field commits the draft and is not prevented, so a surrounding form still submits. In the open preset-time list, Enter still picks a time. A native time control restores the committed time at blur and keeps the rejection shown. A caller error status with a message still shows over the field's message and the rejection is announced once; a warning or success status never hides a rejection. In DateTimeInput the date segment's message comes first, and a time rejection under it sets aria-invalid on the time input and is announced. What a form posts does not change: while blur keeps a rejected TimeInput draft, a hidden input carries the field's name with the committed time as the field shows it, until the draft is edited or a new value replaces it. TimeInput takes an optional onEntryErrorChange that receives a TimeInputEntryError (kind, the typed text, and the ISO time for outOfRange) each time the shown rejection changes, and null when it ends.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Changes requested. The behavior matches the current TimeInput and DateTimeInput records, and the tests cover each rule. Three implementation problems need fixing first:
TimeInput/useTypedTime.ts(lines 208-330) copiesuseTypedDateField's entry-error reporting fromDateInput/useTypedDate.ts(lines 439-557), including the caller-status precedence, the one-time announcement, the report and its two Effects, so move that logic into the existing owner and call it from both fields, so that a later fix reaches date and time fields alike.TimeInput/useTypedTime.tsis a new internal module shared by TimeInput and DateTimeInput, and no current record names it, so it needs an owner decision that says why the existing modules are not enough, or it needs to shrink into the existing owner.- A native time rejection outlives the native control: when
adaptive-nativeswitches to the typed field (pointer change) orhasSeconds/incrementchanges, the field still shows "Invalid time" over a valid committed time until the value changes, so clear that state when the typed surface returns (useTypedTime.tsline 183).
Two smaller notes are inline: DateTimeInput hides the time message while unreadable date text is still being typed, and one comment restates the code.
Claims and files checked
- Claim: the new callback reports a locale-independent kind, the typed text and, for an out-of-range time, its ISO value. Verified in the hook's draft reader and the callback tests.
- Claim: the callback runs on a new min, max or value and on disabling, never twice for one rejection, and with null at the end or at unmount. Verified in the report helper, both Effects and the tests.
- Claim: the native and bottom-sheet surfaces never report. Verified: the sheet branch strips the prop, and the native surface drops the typed draft.
- Claim: before, unfinished drafts were flagged on each keystroke, shown only by text colour, and reverted at blur with no message, and a native edit outside min/max showed no visible message and cleared at blur. Verified against the base TimeInput and NativeTimeSegment. A lone
1was flagged only when 01:00 was out of range. - Claim: an unfinished time is never flagged, a complete out-of-range time shows at once, and unreadable text shows at Enter or blur. Verified in the completeness helper and the hook's reveal rule.
- Claim: rejected text stays, with a visible error status,
aria-invalidand one announcement; inside an InputGroup it is announced. Verified. - Claim: Enter commits and still submits a form, and Enter in the open preset list still picks a time. Verified in both key handlers.
- Claim: a native control restores the committed time at blur and keeps the rejection. Verified; it also keeps it too long (finding 3).
- Claim: a caller error with a message still wins and the rejection is announced once, and a warning or success no longer hides a rejection. Verified.
- Claim: in DateTimeInput the date message comes first and a time rejection under it is announced. Verified, with the inline edge case.
- Claim: what a form posts does not change, because a hidden input carries the name after blur keeps a rejected draft. Verified.
- Claim: apps need no code change, and the new hook is not exported. Verified.
- Claim: the completeness helper reuses the locale reading of the time parser. Verified.
- Claim: the test, typecheck, lint and mutation results. Not reproduced, because CI has not run on this draft head; the changeset check passes.
- Files: both changesets,
docs/families/input-fields.md, the AST-118 record, the DateTimeInput and TimeInput records,en.json, both.doc.mjsfiles,DateTimeInput.test.tsx,NativeTimeSegment.tsx,NativeTimeInput.test.tsx,TimeInput.test.tsx,TimeInput/index.ts,timeFormat.tsandtimeFormat.test.ts: clear. - Files:
useTypedTime.tshas findings 1-3;TimeInput.tsxhas finding 3's surface switch and a comment note;DateTimeInput.tsxhas a non-blocking precedence note.
Resolve DateTimeInput against the date segment's rejected-entry work: the time segment's status and alert sit after the date segment's field status, and the date message, typed or from the native date control, comes first when both segments hold a rejection. Take main's date-segment wording in the docs and records, and keep only the gaps neither change closes.
…ontrol A native time rejection now ends when the field switches to the typed field, as when an adaptive-native field moves to a fine pointer or gains seconds or a non-1 increment, so the typed field never shows "Invalid time" over a valid committed time. DateTimeInput's time message gives way only while the date segment shows its own message, typed or from the native date control. Unreadable date text that is still being typed shows no message, so the time message shows. Remove a comment that restated the change handler.
There was a problem hiding this comment.
Changes requested. The rejected-time behavior now matches the current TimeInput and DateTimeInput records, the relevant suites pass, and the surface-switch problem from the last review is fixed. Three problems still block approval:
TimeInput/useTypedTime.ts(lines 217-339) still copies the entry-error reporting ofuseTypedDateFieldinDateInput/useTypedDate.ts(lines 466-583), so extend that owner and call it from both fields, or land the shared-hook extraction first and build on it, so that a later fix reaches date and time fields alike.TimeInput/useTypedTime.tsis a new internal module shared by TimeInput and DateTimeInput that no current record names, so it needs an owner decision that says why the existing modules are not enough, or it should shrink into the existing owner.- Miss: after a native out-of-range time edit, a field that becomes disabled or busy keeps
aria-invalidand the invalid text colour with no message, and TimeInput shows "Invalid time" again once enabled, so pass the lock-aware rejection toNativeTimeSegment(TimeInput.tsxline 852,DateTimeInput.tsxline 1975), clear the native rejection when the field becomes disabled, and add a native disabled and busy test.
One non-blocking comment-wording note is inline.
Claims and files checked
- Claim: the new callback reports a locale-independent kind, the typed text and, for an out-of-range time, its ISO value. Verified in the hook's draft reader and the callback tests.
- Claim: the callback runs on each change of the shown rejection, including a new min, max or value and disabling, never twice for one rejection, and with null at the end or at unmount. Verified in the report helper, both Effects and the tests.
- Claim: the native and bottom-sheet surfaces never report. Verified: the hook drops the draft without a typed field, and the sheet branch strips the prop.
- Claim: before, unfinished drafts were flagged on each keystroke, shown only by text colour and reverted at blur, and a native edit outside min/max showed no message and cleared at blur. Verified against the base source and base browser frames; a lone
1was flagged only when 01:00 was outside the bounds, as the description says. - Claim: an unfinished time is never flagged, a complete out-of-range time shows at once, and unreadable text shows at Enter or blur. Verified in the completeness helper, the hook and browser frames.
- Claim: rejected text stays, with a visible error status,
aria-invalidand one announcement; inside an InputGroup it setsaria-invalidand is announced. Verified. - Claim: Enter commits and still submits a form, and Enter in the open preset list still picks a time. Verified in both key handlers and tests.
- Claim: a native control restores the committed time at blur and keeps its rejection shown. Verified; it also keeps
aria-invalidwhile the field is locked (finding 3). - Claim: a caller error with a message still wins and the rejection is announced once, and a warning or success no longer hides a rejection. Verified in tests and browser frames.
- Claim: in DateTimeInput the date message comes first, a time rejection under it is announced, and unreadable date text still being typed lets the time message show. Verified.
- Claim: what a form posts does not change, because a hidden input carries the name after blur keeps a rejected draft. Verified.
- Claim: apps need no code change, the new hook is not exported, and the API change is one optional prop and one type. Verified by comparing the built API surface of base and head.
- Claim: the completeness helper reuses the time parser's locale reading. Verified.
- Claim: the records drop the closed gaps and name the tests, and the NumberInput gaps stay. Verified.
- Claim: the catalog gains no message and only the translator note changes. Verified.
- Claim: the test, typecheck, lint, format, knowledge and changeset results. Verified for the time, date-time and date suites (32 files, 1,439 tests) and every listed check; the full-package run and the mutation table were not reproduced.
- Claim: the shared entry-error hook is being extracted in another pull request. That pull request is an open draft, so the copy remains at this head (finding 1).
- Files:
useTypedTime.tshas findings 1-3;TimeInput.tsxhas finding 3 and the comment note;DateTimeInput.tsxhas findings 2 and 3;NativeTimeSegment.tsxhas finding 3. - Files: both changesets,
docs/families/input-fields.md, the AST-118, DateTimeInput and TimeInput records,en.json, both.doc.mjsfiles,DateTimeInput.test.tsx,NativeTimeInput.test.tsx,TimeInput.test.tsx,TimeInput/index.ts,timeFormat.tsandtimeFormat.test.ts: clear.
… field is locked A native time control now marks its rejection only while the field is editable. While the field is disabled or busy it sets no aria-invalid and no invalid text color, as the message and the alert already hide. A TimeInput that becomes disabled drops the rejection with its draft, so it does not return once the field is enabled again; a busy TimeInput, and a locked DateTimeInput time segment, show it again once editable. Reword the comment on untyped form attributes.
There was a problem hiding this comment.
Changes requested. The native time control now hides its rejection while TimeInput is disabled or busy, and the comment wording from the last review is fixed. Three problems still block approval:
TimeInput/useTypedTime.ts(lines 221-343) still copies the entry-error reporting ofuseTypedDateFieldinDateInput/useTypedDate.ts(lines 466-583), so extend that owner and call it from both fields, or land the shared-hook extraction first and build on it, so that a later fix reaches date and time fields alike.TimeInput/useTypedTime.tsis a new internal module shared by TimeInput and DateTimeInput that no current record names, so it needs an owner decision that says why the existing modules are not enough, or it should shrink into the existing owner.DateTimeInput.tsxline 868 locks the time segment only onisEffectivelyDisabled, which leaves out a pendingchangeActionon native segments, so a busy field still shows "Invalid time" andaria-invalidon the native time control; passisEffectivelyDisabled || isBusy, as the native date rejection does, and add a pending-changeActiontest.
The third point is the part of the last review's locked-state finding that this head leaves open.
Claims and files checked
- Claim: the new callback reports a locale-independent kind, the typed text and, for an out-of-range time, its ISO value. Verified in the hook's draft reader and the callback tests.
- Claim: the callback runs on each change of the shown rejection, including a new min, max or value and disabling, never twice for one rejection, and with null at the end or at unmount. Verified in the report helper, both Effects and the tests.
- Claim: the native and bottom-sheet surfaces never report. Verified: the hook drops the draft without a typed field, and the sheet branch strips the prop.
- Claim: before, unfinished drafts were flagged on each keystroke, shown only by text colour and reverted at blur, and a native edit outside min/max showed no message and cleared at blur. Verified against the base source and base browser frames.
- Claim: an unfinished time is never flagged, a complete out-of-range time shows at once, and unreadable text shows at Enter or blur. Verified in the completeness helper, the hook, tests and browser frames.
- Claim: rejected text stays, with a visible error status,
aria-invalidand one announcement; inside an InputGroup it setsaria-invalidand is announced. Verified. - Claim: Enter commits and still submits a form, and Enter in the open preset list still picks a time. Verified in both key handlers and tests.
- Claim: a native control restores the committed time at blur and keeps its rejection shown. Verified.
- Claim: while the field is disabled or busy, the native control marks no rejection, and a TimeInput that becomes disabled drops it. Verified for TimeInput and for a disabled or loading DateTimeInput; false for a DateTimeInput busy with a pending
changeActionon native segments (third point). - Claim: a caller error with a message still wins and the rejection is announced once, and a warning or success no longer hides a rejection. Verified in tests and browser frames.
- Claim: in DateTimeInput the date message comes first, a time rejection under it is announced, and unreadable date text still being typed lets the time message show. Verified.
- Claim: what a form posts does not change, because a hidden input carries the name after blur keeps a rejected draft. Verified.
- Claim: apps need no code change, the new hook is not exported, and the API change is one optional prop and one type. Verified by comparing the built API surface of base and head.
- Claim: the completeness helper reuses the time parser's locale reading. Verified.
- Claim: the records drop the closed gaps and name the tests, and the NumberInput gaps stay. Verified.
- Claim: the catalog gains no message and only the translator note changes. Verified.
- Claim: the shared entry-error hook is being extracted in another pull request. That pull request is still an open draft, so the copy remains at this head (first point).
- Claim: the test, typecheck, lint and format results. Verified for the time, date-time and date suites (32 files, 1,442 tests), the core typecheck, lint and format; the full-package run and the mutation table were not reproduced, and the commit the description names for its runs is not in this pull request's history.
- Files:
useTypedTime.tshas the first and second points;DateTimeInput.tsxhas the second and third points. - Files: both changesets,
docs/families/input-fields.md, the AST-118, DateTimeInput and TimeInput records,en.json, both.doc.mjsfiles,DateTimeInput.test.tsx,NativeTimeSegment.tsx,NativeTimeInput.test.tsx,TimeInput.test.tsx,TimeInput.tsx,TimeInput/index.ts,timeFormat.tsandtimeFormat.test.ts: clear.
Resolve the AST-118 and family gap lines against NumberInput's rejected-entry work: keep only the DateInput gap that main still records, and list every member's rejected-entry suites in the family verification row.
…e family hook useTypedTime now keeps only the time rules: the typed draft, its point of completion, its commit at Enter and blur, the kept draft and its form value, and the native control's rejection. The status a rejection takes over a caller status, the alert, and the onEntryErrorChange report come from Field/useEntryErrorReport, with a caller error status always winning, as in NumberInput. A grouped TimeInput still shows no status of its own. The TimeInput record names useTypedTime and why DateTimeInput's time segment shares it, and the family record lists TimeInput among the hook's users. DateTimeInput's time segment now also hides its native rejection while a changeAction is pending, as the native date rejection does.
|
/approve-spec 8bfff9f |
There was a problem hiding this comment.
Changes requested. The reporting now goes through the shared entry-error hook, the TimeInput record names useTypedTime, and the time segment hides its rejection while a changeAction is pending, so the three problems from the last review are fixed. Two problems block approval:
- Newly live check:
TimeInput/useTypedTime.ts(lines 153-165) drops the kept rejected text whenever a newvaluearrives, so a caller that restores its value from theonBluror Enter that reveals the rejection erases the person's entry and its message inTimeInputandDateTimeInput, whichspec:AST-118FR4, FR6, FR8 and DEC-14 forbid; keep the draft when the same update revealed the rejection, asNumberInputdoes, and add restoring-caller tests for both components. - Miss:
TimeInput/useTypedTime.ts(lines 230-234 and 258) callsreportEntryErrorwhile the field is busy, so withisLoadingor a pendingchangeActiontheonEntryErrorChangecallback receives a rejection, thennull, then the same rejection again once idle, againstspec:AST-118FR10 and FR8; report only while the field is not locked and add busy callback tests.
Claims and files checked
- Claim: the new callback reports a locale-independent kind, the typed text and, for an out-of-range time, its ISO value. Verified in the hook's draft reader and the callback tests.
- Claim: the callback runs on each change of the shown rejection, including a new min, max or value and disabling, never twice for one rejection, and with null at the end or at unmount. Verified while the field is editable; false while it is busy, where it reports a rejection, null, then the same rejection again (second point).
- Claim: the native and bottom-sheet surfaces never report. Verified: the hook drops the draft without a typed field, and the sheet branch strips the prop.
- Claim: before, unfinished drafts were flagged on each keystroke, shown only by text colour and reverted at blur, and a native edit outside min/max showed no message and cleared at blur. Verified against the base source and base browser frames.
- Claim: an unfinished time is never flagged, a complete out-of-range time shows at once, and unreadable text shows at Enter or blur. Verified in the completeness helper, the hook, tests and browser frames.
- Claim: rejected text stays, with a visible error status, aria-invalid and one announcement; inside an InputGroup it sets aria-invalid and is announced. Verified, except when the caller passes a new value at the revealing Enter or blur, where the text is dropped (first point).
- Claim: Enter commits and still submits a form, and Enter in the open preset list still picks a time. Verified in both key handlers and tests.
- Claim: a native control restores the committed time at blur and keeps its rejection shown, and hides it while the field is disabled or busy, including a pending change action. Verified in tests.
- Claim: a caller error with a message still wins and the rejection is announced once, and a warning or success no longer hides a rejection. Verified in tests and browser frames.
- Claim: in DateTimeInput the date message comes first, a time rejection under it is announced, and unreadable date text still being typed lets the time message show. Verified in tests.
- Claim: what a form posts does not change, because a hidden input carries the name after blur keeps a rejected draft. Verified in tests.
- Claim: status, alert and report go through the shared entry-error hook with caller errors always winning, and a grouped field shows no status of its own. Verified in the hook call and the grouped tests.
- Claim: apps need no code change, the new hook is not exported, and the API change is one optional prop and one type. Verified by comparing the built API surface of base and head.
- Claim: the completeness helper reuses the time parser's locale reading. Verified.
- Claim: the records drop the closed gaps, name the tests and name the new hook. Verified; the dropped first-point gap lines overstate conformance until the first point is fixed.
- Claim: the catalog gains no message and only the translator note changes. Verified.
- Claim: the test, typecheck, lint and browser results. Verified for the time, date-time, date, number, field and input-group suites (53 files, 2,038 tests), the core typecheck, lint and three Chromium scenarios; the full-package run and the mutation table were not reproduced.
- Files:
useTypedTime.tshas both points;DateTimeInput.tsxshares the first point through the hook. - Files: the AST-118, TimeInput and DateTimeInput records and both changesets carry promises the two points break.
- Files:
docs/families/input-fields.md,en.json, both.doc.mjsfiles,DateTimeInput.test.tsx,NativeTimeSegment.tsx,useEntryErrorReport.ts,NativeTimeInput.test.tsx,TimeInput.test.tsx,TimeInput.tsx,TimeInput/index.ts,timeFormat.tsandtimeFormat.test.ts: clear.
…estores its value A value that the caller passes in the same update as an Enter or blur that keeps a rejected time, as a caller that restores its own value at that commit does, no longer replaces the kept text. The text, its message, and its rejection stay, and a later new value replaces them. A disabled or busy TimeInput no longer reports a rejection that typing, Enter, or blur causes. It reports null while locked, and the rejection once the field is editable, so the caller does not receive the same rejection twice.
|
/approve-spec db6affb |
There was a problem hiding this comment.
Approved pending CI. Required CI is still running on this head, so the pull request merges only once those checks pass. The two problems from the last review are fixed: a caller value passed at the Enter or blur that keeps a rejected time now keeps the text and its message, and a disabled or busy TimeInput no longer reports rejections from its handlers, both with tests that fail on the previous head. One optional comment suggestion is inline.
Claims and files checked
- Claim: the new callback reports a locale-independent kind, the typed text and, for an out-of-range time, its ISO value. Verified in the hook's draft reader and the callback tests.
- Claim: the callback runs on each change of the shown rejection, including a new min, max or value and disabling, never twice for one rejection, and with null at the end or at unmount. Verified in the callback tests, including the busy and pending-action cases.
- Claim: the native and bottom-sheet surfaces never report. Verified: the hook drops the draft without a typed field, and the sheet branch strips the prop.
- Claim: before, unfinished drafts were flagged on each keystroke, shown only by text colour and reverted at blur, and a native edit outside min/max showed no message and cleared at blur. Verified against the base source and base browser frames.
- Claim: an unfinished time is never flagged, a complete out-of-range time shows at once, and unreadable text shows at Enter or blur. Verified in the completeness helper, the hook, tests and browser frames.
- Claim: rejected text stays, with a visible error status, aria-invalid and one announcement; inside an InputGroup it sets aria-invalid and is announced. Verified in tests and browser frames.
- Claim: a value the caller passes at the Enter or blur that keeps a rejected time keeps the text, its rejection and its message, and a later value replaces it. Verified in both components' restoring-caller tests.
- Claim: a disabled or busy field marks, shows, announces and reports nothing, then shows and reports a kept rejection once editable, and a disabled TimeInput drops its draft. Verified in tests.
- Claim: Enter commits and still submits a form, and Enter in the open preset list still picks a time. Verified in both key handlers and tests.
- Claim: a native control restores the committed time at blur and keeps its rejection shown, and a switch to the typed field ends it. Verified in tests.
- Claim: a caller error with a message still wins and the rejection is announced once, and a warning or success no longer hides a rejection. Verified in tests and browser frames.
- Claim: in DateTimeInput the date message comes first, a time rejection under it is announced, and unreadable date text still being typed lets the time message show. Verified in tests.
- Claim: what a form posts does not change, because a hidden input carries the name and form after blur keeps a rejected draft. Verified in tests.
- Claim: apps need no code change, the new hook is not exported, and the API change is one optional prop and one type. Verified by comparing the built API surface of base and head.
- Claim: the completeness helper reuses the time parser's locale reading, and the shared entry-error hook changes only in its header. Verified.
- Claim: the records drop the closed gaps, name the tests and name the new hook, and the catalog only updates its translator note. Verified.
- Claim: the test, typecheck, lint, formatting, knowledge and changeset results. Verified on this head for the time, date-time, date, number, field and input-group suites (54 files, 2,084 tests) and every listed check; the full-package run, the mutation table and the native browser scenarios were not reproduced, and the transcript names commits that are not in the branch history.
- Claim: 1,998 authored lines. Verified.
- Files:
useTypedTime.tshas one optional comment suggestion. - Files: both changesets,
docs/families/input-fields.md, the three spec records,en.json, both.doc.mjsfiles,DateTimeInput.test.tsx,DateTimeInput.tsx,NativeTimeSegment.tsx,useEntryErrorReport.ts,NativeTimeInput.test.tsx,TimeInput.test.tsx,TimeInput.tsx,TimeInput/index.ts,timeFormat.tsandtimeFormat.test.ts: clear.
| // How the draft was last committed. After blur, a hidden input carries the | ||
| // field's name until the next edit. | ||
| const [committedBy, setCommittedBy] = useState<'enter' | 'blur' | null>(null); | ||
| // Counts the commits that kept a rejected draft. |
There was a problem hiding this comment.
Non-blocking (comment style): this repeats keptCommits and its count + 1 update; the reason is in the comment at line 153. Suggest keeping only the reason: "A value passed in the same update as one of these commits keeps the draft."
|
/approve-spec ef16e6e |
There was a problem hiding this comment.
Approved pending CI. The rejected-time behavior matches the current TimeInput, DateTimeInput and rejected-entry records, the record edits carry an engineering owner's approval for this head, and the one new commit correctly drops the four lint-baseline entries for the comments this pull request removed, so the lint check passes now.
- Next: the main CI run on this head was refused for capacity ("CI is full") and cancelled, so CI needs a re-run before this merges.
- Non-blocking: the comment at
useTypedTime.ts:104still restateskeptCommits; keeping only the reason would read better.
Claims and files checked
- Claim, feature changeset:
onEntryErrorChangereports each change of a typed-text rejection withkind,textand, out of range,value, never twice, andnullat its end or at unmount; the native and sheet surfaces never report. Verified (useTypedTime.ts:33-44,:222-235;TimeInput.tsx:1046; theonEntryErrorChangeand native "never reports" tests). - Claim, fix changeset: unfinished times are never flagged, a complete out-of-range time shows at once, unreadable text shows at Enter or blur, the text stays, and a standalone field shows "Invalid time" as its error status with
aria-invalidand one announcement. Verified (rejected-entry suites; Chromium frames). - Claim, fix changeset: Enter commits and still submits a form, the open preset list still picks, a native edit is restored at blur with its rejection kept, a caller error with a message wins, a warning or success no longer hides a rejection, the date message comes first, and a hidden input posts the committed time. Verified (Enter-in-a-form, preset-list, native, caller-status, both-segments and hidden-input tests).
- Claim, description: apps change no code and accepted times still reach
onChangeas before. Verified (existingonChangetests pass). - Claim, description: status, alert and report go through the shared entry-error hook, which changes only in its header. Verified (
useTypedTime.ts:222-229; the hook's diff). - Claim, description: the new internal hook holds the time rules and the TimeInput record names it. Verified (
TimeInput.spec.md:96-103). - Claim, description: completion reuses the locale reading of the time parser. Verified (
timeFormat.ts:252,:330;isLocaleTimeCompletetests). - Claim, description: a
valuepassed at the Enter or blur that keeps a rejected draft keeps it. Verified (useTypedTime.ts:157-174; restoring-caller tests). - Claim, description: disabled and busy fields show and report nothing and report once editable; TimeInput drops its draft when disabled. Verified (
useTypedTime.ts:175-184,:213-235; disabled and busy tests). - Claim, description: the record gap lines are removed and the verification rows name tests; the catalog adds no message. Verified (record diffs; knowledge check;
en.json). - Claim, description: the public API adds only the optional prop and its error type; the native segment gains three internal props. Verified (built API surface;
NativeTimeSegment.tsx). - Claim, description: the listed known limits (prefix commit, no unit test of the hook, DateTimeInput keeps its draft through a lock). Verified as stated.
- Claim, description: 1,998 authored lines. Verified, counting the regenerated lint baseline as generated (2,002 changed lines).
- Claim, description: the test, typecheck, lint, knowledge, changeset and formatting runs pass. Verified by re-running them on this head, plus real-browser checks of Enter submission, the hidden-input post and the native restore; the full-package run and the mutation table were not re-run.
- Files:
.changeset/time-input-entry-error-change.md,.changeset/time-input-rejected-entry.md,docs/families/input-fields.md,docs/specs/AST-118-rejected-entry-feedback/spec.md,docs/specs/components/DateTimeInput/DateTimeInput.spec.md,docs/specs/components/TimeInput/TimeInput.spec.md,internal/eslint-plugin-astryx/no-comment-provenance.baseline.json,packages/core/locales/en.json,packages/core/src/DateTimeInput/DateTimeInput.doc.mjs,packages/core/src/DateTimeInput/DateTimeInput.test.tsx,packages/core/src/DateTimeInput/DateTimeInput.tsx,packages/core/src/DateTimeInput/NativeTimeSegment.tsx,packages/core/src/Field/useEntryErrorReport.ts,packages/core/src/TimeInput/NativeTimeInput.test.tsx,packages/core/src/TimeInput/TimeInput.doc.mjs,packages/core/src/TimeInput/TimeInput.test.tsx,packages/core/src/TimeInput/TimeInput.tsx,packages/core/src/TimeInput/index.ts,packages/core/src/utils/timeFormat.test.ts,packages/core/src/utils/timeFormat.ts: clear. - File:
packages/core/src/TimeInput/useTypedTime.ts: one non-blocking comment suggestion at line 104.
Resolve the AST-118 gap list and the DateTimeInput FR16 verification row against the date segment's commit-value work: no time-segment gap remains, and the row names both segments' suites.
…the family hook useTypedTime asks Field/useValueReplacesEntry whether a new value replaces the kept draft, with the count of commits that keep a rejected draft as the keep signal, in place of its own record. The echo of a time that typing committed still keeps the draft. The family record lists TimeInput among the members that share useEntryErrorReport and useValueReplacesEntry.
|
/approve-spec 971db25 |
There was a problem hiding this comment.
Approved pending CI. The rejected-time behavior matches the current TimeInput, DateTimeInput and rejected-entry records, the record edits carry an engineering owner's approval for this head, and moving the restored-value rule onto the shared value-replacement hook keeps the behavior its tests guard.
- Next: CI's test legs are still running on this head, so this merges only once they pass.
- Non-blocking: the comment at
useTypedTime.ts:106still restateskeptCommits; naming its role as the keep signal foruseValueReplacesEntrywould read better.
Claims and files checked
- Feature changeset: the new callback reports why typed text is rejected, with a locale-independent kind, the typed text and, out of range, the ISO time; it runs on each change of the shown rejection (including a new min, max or value, or disabling), never twice, and with null at its end or at unmount; the native and bottom-sheet surfaces never report. Verified (
useTypedTime.ts:35-46,:119-147,:216-229;TimeInput.tsxsheet case; the onEntryErrorChange and native/sheet "never reports" tests). - Fix changeset: unfinished times are never flagged, a complete out-of-range time shows at once, unreadable text shows at Enter or blur, the text stays, and a standalone field shows "Invalid time" as its error status with
aria-invalidand one announcement; in an InputGroup it setsaria-invalidand is announced. Verified (rejected-entry suites; Chromium frames). - Fix changeset: Enter commits and still submits a form, the open preset list still picks, a native edit is restored at blur with its rejection kept, a caller error with a message wins and the rejection is announced once, a warning or success no longer hides a rejection, the date message comes first, and a hidden input posts the committed time after blur. Verified (Enter-in-a-form, preset-list, native, caller-status, both-segments and hidden-input tests).
- Description: apps change no code; the committed value,
onChangeand what a form posts behave as before. Verified (existingonChangetests pass; hidden-input tests). - Description: status, alert and report go through the shared entry-error hook with caller errors always winning, as NumberInput does. Verified (
useTypedTime.ts:216;NumberInput.tsx:807). - Description: a value passed at the Enter or blur that keeps a rejected draft keeps it, decided by the shared value-replacement hook with the count of keeping commits as its signal; the echo of a typed commit also keeps it. Verified (
useTypedTime.ts:158-168; restoring-caller tests, which fail when the signal is removed). - Description: the new internal hook holds only the time rules and the TimeInput record names it. Verified (
TimeInput.spec.md:96-103). - Description: completion reuses the time parser's locale reading. Verified (
timeFormat.ts:252,:330; completion tests). - Description: disabled and busy fields show and report nothing and report once editable; TimeInput drops its draft and native rejection when disabled; DateTimeInput's native segments lock while busy too. Verified (
useTypedTime.ts:169-178,:207-229; disabled and busy tests). - Description: in DateTimeInput, the date message shows whenever it shows, and unreadable date text still being typed leaves the time message showing. Verified (
DateTimeInput.tsx:1106-1114; both-segments tests). - Description: the record gap lines are removed, the verification rows name tests, and the catalog adds no message. Verified (record diffs; knowledge check;
en.json). - Description: the public API adds only the optional prop and its error type; the native segment gains three internal props; the two family hooks change only in their header comments. Verified (built API surface; diffs).
- Description: the listed known limits (prefix commit, empty native value while retyping, DateTimeInput keeps its draft through a lock, TimeInput hides its rejection while busy, no unit test of the hook). Verified as stated.
- Description: 1,995 authored lines. Verified as the repository's count; 1,991 with the regenerated lint baseline excluded.
- Description: the test, typecheck, lint, formatting, baseline, knowledge and changeset runs pass, and the branch merges cleanly into main. Verified by re-running them and the merge on this head, plus one of the listed mutations; the full-package run and the earlier real-browser checks were not re-run.
- Files:
.changeset/time-input-entry-error-change.md,.changeset/time-input-rejected-entry.md,docs/families/input-fields.md,docs/specs/AST-118-rejected-entry-feedback/spec.md,docs/specs/components/DateTimeInput/DateTimeInput.spec.md,docs/specs/components/TimeInput/TimeInput.spec.md,internal/eslint-plugin-astryx/no-comment-provenance.baseline.json,packages/core/locales/en.json,packages/core/src/DateTimeInput/DateTimeInput.doc.mjs,packages/core/src/DateTimeInput/DateTimeInput.test.tsx,packages/core/src/DateTimeInput/DateTimeInput.tsx,packages/core/src/DateTimeInput/NativeTimeSegment.tsx,packages/core/src/Field/useEntryErrorReport.ts,packages/core/src/Field/useValueReplacesEntry.ts,packages/core/src/TimeInput/NativeTimeInput.test.tsx,packages/core/src/TimeInput/TimeInput.doc.mjs,packages/core/src/TimeInput/TimeInput.test.tsx,packages/core/src/TimeInput/TimeInput.tsx,packages/core/src/TimeInput/index.ts,packages/core/src/utils/timeFormat.test.ts,packages/core/src/utils/timeFormat.ts: clear. - File:
packages/core/src/TimeInput/useTypedTime.ts: one non-blocking comment suggestion at line 106.
User impact
People who type a time in
TimeInput, or inDateTimeInput's time field, in a standalone field. Before this change, every draft that was not an accepted time was marked invalid and announced on each keystroke, including an unfinished1when 01:00 was out of range; the only visible sign was secondary-color text; and blur reverted the draft with no message. A native time edit outsidemin/maxshowed no message, and its rejection vanished at blur. A sighted person never saw why the entry failed (WCAG 2.2 1.4.1, 3.3.1), and a screen-reader user heard false alarms while typing.Now an unfinished time is never flagged. A rejected time shows the "Invalid time" message as the field's error status, with
aria-invalidand one announcement, and the typed text stays so it can be corrected. Apps change no code: the committed value,onChange, and what a form posts behave as before.Problem and solution fit
The fix gives a typed time a point of completion, reveals rejections at that point or at Enter or blur, keeps the rejected text, and routes the message through the field's existing error status, so all signals move together.
Expected behavior and authority
spec:AST-118FR1–FR10, AR1–AR4, DEC-6, DEC-7, DEC-9, DEC-11, DEC-13, DEC-14 (docs/specs/AST-118-rejected-entry-feedback/spec.md).component:TimeInputFR3, FR6, FR11, FR14, FR15, AR2, and its ownership boundary, which namesuseTypedTime.component:DateTimeInputFR8, FR16 (time segment and the both-segments rule).family:input-fieldsFR15 and its Shared owner section (useEntryErrorReport,useValueReplacesEntry).spec:AST-017FR53, shipped as a patch[fix];onEntryErrorChangeandTimeInputEntryErrorare optional additions that the same record admits underspec:AST-017FR5 ([feat]changeset).Smallest restoration
Field/useEntryErrorReportwithcallerErrorPrecedence: 'always', as NumberInput does. It decides the status a shown rejection takes over a callerstatus, the alert that announces a message no shown status announces (including an unchanged caller error once when a rejection starts), and theonEntryErrorChangereport (from the causing handler, after render for a prop change, never twice,nullat unmount). A grouped TimeInput still shows no status of its own; the group's status channel announces a caller status message, and the alert carries the rejection.valuepassed at the commit (DEC-14):useTypedTimeasks the family hookField/useValueReplacesEntrywhether a newvaluereplaces the kept draft, with the count of commits that keep a rejected draft as the keep signal. Avaluethat the caller passes in the same update as an Enter or blur that keeps a rejected draft, as a caller that restores its own value at that commit does, keeps the draft, its rejection, and its message, and reports nothing; a later newvaluereplaces the draft. The echo of a time that typing committed also keeps the draft. This applies to TimeInput and DateTimeInput's time segment.useTypedTime(internal,TimeInput/useTypedTime.ts) keeps only the time rules: the typed draft, its point of completion, its commit at Enter and blur, the kept draft and the form value it posts, and the native control's rejection.component:TimeInput's ownership boundary names it: DateTimeInput's time segment shares it becausecomponent:DateTimeInputFR16 gives the segmentcomponent:TimeInputFR14's rules, the same way DateTimeInput already importsDateInput/useTypedDateand TimeInput importsDateTimeInput/NativeTimeSegment. The family hooks own only the status, alert, report, and value replacement, anduseTypedDatereads dates, so none of them holds the time rules. AST-118's path list already coverspackages/core/src/TimeInput/**; its behavior is verified through the TimeInput and DateTimeInput suites already in each record'sverified_by.spec:AST-118FR1.2):isLocaleTimeCompleteinutils/timeFormat.tsreuses the locale reading ofparseLocaleTime(now split into one shared helper) and requires the hours, both minute digits, both second digits when the field shows seconds, and, in a 12-hour field, a day period unless the hour reads 0 or 13–23.TimeInputdraft, a hidden input carriesname(and the caller'sformattribute) with the committed time as the field shows it, and the typed input carries none, until an edit or a newvalue. The time segment still carries noname.NativeTimeSegmentreports its rejection to the owner, which shows it like a typed rejection; blur restores the committed time (existing unfocused sync) and no longer clears the rejection. An accepted or emptied edit, a new value, or a switch to the typed field (a pointer change onadaptive-native, orhasSecondsor a non-1increment) ends it.isLoading, or a pendingchangeAction; in DateTimeInput's native segments too, as the native date rejection does), the field marks, shows, and announces no rejection, reportsnull, and its handlers report nothing, so the caller does not receive a rejection, thennull, then the same rejection again. Once the field is editable, a rejection it kept is shown and reported once. ATimeInputthat becomes disabled drops its draft and its native rejection (component:TimeInputFR9), so neither returns once enabled; a busyTimeInput, and a lockedDateTimeInputtime segment, which keeps its draft through a lock, show and report the rejection again once editable.DateTimeInput: the field status shows the date segment's message whenever that message shows, typed or from the native date control; a time rejection under it setsaria-invalidon the time input and is announced through the time alert. Unreadable date text that is still being typed shows no message, so the time message shows meanwhile. Date-segment code paths are unchanged apart from passing the combined status toField, the status icon, andaria-describedby.useEntryErrorReport, whichuseValueReplacesEntry's bullet refers to as "the same members"; the TimeInput record namesuseTypedTime, and TimeInput FR11 states DEC-14 for the kept draft.@astryx.timeInput.invalidTimetranslator description now says the message is visible and the text stays.API delta (internal and public):
Internal only:
useTypedTime(named incomponent:TimeInput; imported byTimeInputandDateTimeInput),isLocaleTimeComplete, and three required props on the internalNativeTimeSegment(isRejected,onRejectedChange,alertMessage). No change touseEntryErrorReportoruseValueReplacesEntrybeyond their header comments.Evidence
25:99in a TimeInput setaria-invalidand filled the hidden alert on the first keystroke that did not parse; blur restored2:30 PMwith no message (the replaced tests "sets aria-invalid="true" when typed input is out of range", "announces an alert message when typed input is invalid", and "reverts to previous value on blur when input is invalid" asserted that behavior).TimeInput.test.tsx"TimeInput rejected entries" (with "in a form", "with a caller status", and "onEntryErrorChange", including the restoring-caller and theisLoadingand pending-changeActionreport cases),NativeTimeInput.test.tsx"TimeInput native rejected entries" (including the surface-switch and the busy and disabled cases),DateTimeInput.test.tsx"time segment rejected entries" (including the restoring-caller, native disabled, busy, and pending-changeActioncases), andtimeFormat.test.ts"isLocaleTimeComplete".min08:00,max17:00):18:3→ noaria-invalid, no status;18:30→aria-invalid="true", status "Invalid time";25:99while typing → nothing; Enter → text25:99kept, status "Invalid time", form submitted withstart=25:99; blur → text kept, typed input has noname, form posts9:00 AM.presentation="native": typing6,30,P→ value18:30,aria-invalid="true", status "Invalid time"; Enter → value still18:30; blur → value restored to09:00,aria-invalid="true"and status "Invalid time" stay.presentation="adaptive-native"under a coarse pointer (isMobile,hasTouch): native edit to18:30→ status "Invalid time"; thenhasSecondsturns on → typed field shows9:00:00 AMwith noaria-invalidand no status.timeOptionInterval:x+ Enter in the closed time field → text kept,aria-invalid="true", status "Invalid time", form submitted; Alt+ArrowDown, ArrowDown, Enter → picks10:30 AM, no submission.minof 09:00:8:30 AM→ status "Invalid time";tomorrowishtyped in the focused date field → status still "Invalid time", date input notaria-invalid; blur → status "Invalid date", time inputaria-invalid="true", time alert "Invalid time".presentation="native"with achangeActionthat stays pending: native time8:00 AMbefore a 9:00 minimum → blur restores10:00, status "Invalid time",aria-invalid="true"; native date changed to 2026-03-16 →aria-busy="true"on the time control, noaria-invalid, no status.onChangewhile typed (calls onChange immediately when input becomes valid,calls onChange on blur when input is valid), arrow-key stepping, the preset-time list, the sheet surface, every date-segment suite, and every NumberInput suite from main pass unchanged.Scope
Components: TimeInput, DateTimeInput (time segment and the both-segments rule), NativeTimeSegment (internal), utils/timeFormat
onEntryErrorChangeprop andTimeInputEntryErrortype are new public API. They are not hidden:spec:AST-118FR8 andcomponent:TimeInputFR15 decide them as part of the same fix, and they ship with their own[feat]changeset.Not in this change:
entryErrorBehavior(spec:AST-117;component:TimeInputFR13 andcomponent:DateTimeInputFR15 keep that gap).Known limits, recorded rather than changed:
component:TimeInputFR3 andcomponent:DateTimeInputFR7 keep their gap: the typed field still commits a parsed prefix (2commits 02:00). After such a commit, a later rejected draft posts that committed time from the hidden input. The gap line stays in both records.DateTimeInput's time segment keeps its typed draft and its native rejection while the field is disabled or busy and shows the rejection again once editable;spec:AST-118FR10 names a dropped draft only forTimeInput.TimeInputhides its rejection while busy (isLoadingor a pendingchangeAction) and keeps the draft, perspec:AST-118FR10.useTypedTimehas no unit test of its own; the TimeInput and DateTimeInput suites drive it end to end.Testing
All runs on the branch head 971db25, Node 24.22.1, pnpm 11.10.0.
Mutation checks (each mutation applied alone, then restored). M1–M28 ran on the first commit, M29–M31 on e3ef72d, M32–M33 on a7bf5c07c0, M34–M39 on 8bfff9f, M40–M43 on db6affb, and M44–M47 on 971db25 against the glue around
useValueReplacesEntry.isLocaleTimeCompletenameon the hidden inputnullreport at unmount'withCallback'precedence)changeActionvaluepassed at the commit that keeps a rejected draft drops ituseValueReplacesEntrynever changesReal-browser check: Chromium 149 headless through Playwright on 8bfff9f, results under Evidence. Not run: Firefox, WebKit, and screen-reader passes (
spec:AST-009).Writing rubric results
Records touched:
docs/specs/components/TimeInput/TimeInput.spec.md,docs/specs/components/DateTimeInput/DateTimeInput.spec.md,docs/families/input-fields.md,docs/specs/AST-118-rejected-entry-feedback/spec.md.useTypedTimeand a DEC-14 clause to FR11 in the TimeInput record, and extend the family Shared owner bullet's member list.#followed by digits,/pull/, and/issues/in the touched lines.<id> gap:and "Implementation gap:" forms; the AST-118 list keeps only the AR3 gap outside this fix.