Repository navigation
fix(DateInput, DateTimeInput): a value passed at the revealing commit keeps the rejected date entry - #11470
Conversation
…s a rejected date keeps it When an app set value in the same update as the Enter or blur that kept rejected date text, as an app does when it restores the date it had before the edit, DateInput and DateTimeInput's date segment dropped the text, its message, and aria-invalid, and reported null through onEntryErrorChange. A native date control lost its rejection message the same way. A value that changes in the update where Enter or blur keeps rejected text, or shows a native rejection, now leaves the text and the rejection in place and reports nothing. A later new value replaces the text, as before, and a date the person types again after the restore reports again. AST-118 no longer lists the DateInput FR4, FR6 gap. DateInput FR25 states the rule, and the DateInput and DateTimeInput verification rows name the new tests.
NumberInput's comment over its shown rejection and Pagination's comment over its rejected-entry state no longer restate the state's name; each keeps only the reason.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
/approve-spec 3c0bf98 |
|
AI review status for this pull request.
|
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
There was a problem hiding this comment.
Changes requested: the fix works for a value passed at the Enter or blur that reveals a rejected date, but the release note and record promise more than the code does, and two smaller issues need fixing.
- The changeset and the new DateInput FR25 clause say a
valuepassed at "the Enter or blur that keeps" a rejected date no longer erases it, yetuseTypedDate.tsspares only the first keeping commit, so a caller that restores at blur still erases the text, its message andaria-invalid(and reportsnull) when the person presses Enter and then leaves the field; either say "the Enter or blur that reveals the rejection", as AST-118 FR4 and DEC-14 do, or key the rule on every keeping commit and add a test for Enter then blur. - The new rule in
useTypedDateFieldanduseNativeDateRejectioncopies NumberInput's render-phase rule with a different key, and the copies already disagree (after Enter then a blur that setsvalue, NumberInput keeps its draft while DateInput erases its text), so move the rule into one shared helper besideuseEntryErrorReportthat all three members call once. - The changeset names no accessibility target, which AST-017 FR53 requires for an accessibility behavior fix; add the success criterion it serves (WCAG 2.2 3.3.1, Error Identification), as the earlier AST-118 changesets do.
The new tests fail on main and pass here, and the targeted suites, typecheck, lint and knowledge checks are clean. Two new source comments run past the 25-word sentence limit; inline suggestions show shorter wording.
Claims and files checked
- Claim: patch
[fix]for@astryxdesign/core(verified, changeset front matter). - Claim: a
valuepassed at the Enter or blur that keeps a rejected date no longer erases it (verified for the revealing commit by the new tests; false for Enter then a restoring blur). - Claim: a native control keeps its rejection message the same way (verified for the blur that shows it; false for Enter then a restoring blur).
- Claim: nothing is reported when the caller restores (verified at the revealing commit; false after Enter then a restoring blur, which reports
null). - Claim: a later new
valuereplaces the text (verified, Replace steps in the new tests). - Claim: no app code changes are needed (verified, built API surface unchanged).
- Claim: the new tests give 9 failed and 2 passed against main's hook, and 11 passed with the fix (verified).
- Claim: the targeted suites pass, 72 files and 2672 tests (verified); typecheck, lint with one existing warning, Prettier, knowledge and changeset checks pass (verified).
- Claim:
useEntryErrorReport, TimeInput and the time segment are unchanged (verified, diff). - Claim: a date typed again after the restore reports again (verified, new test).
- Claim: the gap line is removed, FR25 states the rule and the verification rows name the new tests (verified; the FR25 wording is the first finding).
- Claim: NumberInput and Pagination change comments only (verified).
- Claim: 334 authored lines (verified).
- Claim: each listed mutation fails at least one test (not re-run).
- File
.changeset/date-commit-value-keeps-entry.md: first and third findings. - File
docs/specs/AST-118-rejected-entry-feedback/spec.md: clear. - File
docs/specs/components/DateInput/DateInput.spec.md: first finding (FR25 wording). - File
docs/specs/components/DateTimeInput/DateTimeInput.spec.md: clear. - File
packages/core/src/DateInput/DateInput.test.tsx: clear; no case for a value at a second keeping commit (first finding). - File
packages/core/src/DateInput/NativeDateField.test.tsx: clear. - File
packages/core/src/DateInput/useTypedDate.ts: first and second findings; comment-length suggestions. - File
packages/core/src/DateTimeInput/DateTimeInput.test.tsx: clear. - File
packages/core/src/NumberInput/NumberInput.tsx: clear. - File
packages/core/src/Pagination/Pagination.tsx: clear.
…eps a rejected date keeps it A value that the caller passed with a blur after an Enter that already kept rejected date text still erased the text, its message, and aria-invalid, and reported null: only the first keeping commit spared the entry. A native date control lost its rejection the same way when a blur followed the Enter that showed it. A new internal hook, Field/useValueReplacesEntry, decides whether a new value replaces a kept entry. It takes the value and a signal that changes at each Enter or blur that keeps rejected text, and returns false for a value that arrives in the same update as that signal. DateInput's typed field counts each keeping commit, and its native rejection counts each Enter and blur, so a value at any of them keeps the entry. A later new value still replaces it. AST-118 FR4, FR6, FR8, and DEC-14 now say "an Enter or blur that keeps rejected text" in place of "the Enter or blur that reveals the rejection", following the owner's rule to prefer keeping invalid input with a chance to correct it. NumberInput FR3 matches. The input-fields family names the hook in its Shared owner section. The Changeset names WCAG 2.2 3.3.1 (Error Identification) as the accessibility target.
…ces a kept draft NumberInput kept its own copy of the rule that DateInput now takes from Field/useValueReplacesEntry. It passes its value and its shown rejection, which each Enter or blur that keeps a draft sets anew, so the three members stay in step. No behavior change.
|
/approve-spec da3d8f5 |
There was a problem hiding this comment.
Approved pending CI: the required checks are still queued or running on this head.
The three points from the previous review are resolved: a value restored at a blur after Enter now keeps the typed text and the native rejection, useValueReplacesEntry is the one owner of the rule for DateInput, DateTimeInput's date segment and NumberInput, and the changeset names WCAG 2.2 3.3.1. The new restore tests fail against main and pass here, and the targeted suites, typecheck, lint, formatting and knowledge checks are clean.
Optional: the title still says "at the revealing commit"; "a value at any Enter or blur that keeps a rejected date keeps it" would match the changeset and the decision record.
Claims and files checked
- Claim: a patch
[fix]for@astryxdesign/core(verified, changeset front matter). - Claim: a
valuethe app passes at any Enter or blur that keeps a rejected date no longer erases it, a blur after an Enter included (verified: the new tests pass here and fail againstmain; the two Enter-then-blur tests also fail against the previous revision). - Claim: before, the field dropped the text, its message and
aria-invalidand reportednull(verified: the red-first run reportsnullat the restore). - Claim: a native date control lost its rejection message the same way and now keeps it (verified: native tests and a Chromium capture).
- Claim: nothing is reported when the app restores, and a later new
valuereplaces the text (verified: report and Replace steps in the new tests). - Claim: the changeset names the accessibility target, WCAG 2.2 3.3.1 (verified).
- Claim: no app code changes are needed (verified: the built API surfaces of Core and the themes are unchanged).
- Claim: unreadable, incomplete, nonexistent and out-of-range text all take the kept path (verified: one keeping branch in
useTypedDate.ts; tests cover unreadable and nonexistent text). - Claim: one internal hook holds the rule for the typed field, the native rejection and NumberInput, returns true at most once per new
value, and false when the keep signal changed in the same update (verified: hook code and its 5 tests). - Claim: NumberInput behaves as before (verified: equivalent logic, NumberInput suites pass).
- Claim:
useEntryErrorReport, TimeInput and the time segment are unchanged, and an open TimeInput pull request owns those paths (verified: diff; such a pull request is open). - Claim: the 13 restore tests give 11 failed and 2 passed against
main's hook, 2 failed against the previous revision, and 13 passed here (verified). - Claim: the targeted suites, typecheck, lint with one existing warning, Prettier, knowledge, changeset and SYNC checks pass (verified; targeted suites re-run over the DateInput, DateTimeInput, NumberInput, Field, Pagination, TimeInput, Table filtering and DateRangeInput folders).
- Claim: the full Core suite and the changeset coverage script pass (not re-run).
- Claim: each of the 14 listed mutations fails at least one test (4 spot-checked, each fails at least one test).
- Claim: 545 authored lines and a clean merge into
main(verified). - Claim: the records change as listed, the NumberInput FR3 row keeps its length, and the NumberInput and Pagination comment rewrites change no behavior (verified).
- File
.changeset/date-commit-value-keeps-entry.md: clear. - File
docs/families/input-fields.md: clear. - File
docs/specs/AST-118-rejected-entry-feedback/spec.md: clear. - File
docs/specs/components/DateInput/DateInput.spec.md: clear. - File
docs/specs/components/DateTimeInput/DateTimeInput.spec.md: clear. - File
docs/specs/components/NumberInput/NumberInput.spec.md: clear. - File
packages/core/src/DateInput/DateInput.test.tsx: clear. - File
packages/core/src/DateInput/NativeDateField.test.tsx: clear. - File
packages/core/src/DateInput/useTypedDate.ts: clear. - File
packages/core/src/DateTimeInput/DateTimeInput.test.tsx: clear. - File
packages/core/src/Field/useValueReplacesEntry.test.tsx: clear. - File
packages/core/src/Field/useValueReplacesEntry.ts: clear. - File
packages/core/src/NumberInput/NumberInput.tsx: clear. - File
packages/core/src/Pagination/Pagination.tsx: clear.
User impact
People who type a date into a
DateInput, or into the date segment of aDateTimeInput, inside an app that restores its ownvalueat an Enter or blur that ends an edit. A live filter does this when it puts back the date it had before the edit. When the person's text was rejected (unreadable, incomplete, a date the calendar does not have, or outsidemin,max, ordateConstraints), the field dropped the text, its message, andaria-invalidin that same update, and reportednullthroughonEntryErrorChange. The person lost what they typed with no message, and could not correct it. A native date control lost its rejection message the same way after it restored the committed date.After this change the rejected text, its rejection, and its message stay at every Enter or blur that keeps them, a blur after an Enter included, so the person can correct the entry, and nothing is reported. A later new
valuereplaces the text, as before.Problem and solution fit
useTypedDateFielddropped typed text on every newvalue. It could not tell avaluethat arrives in the same update as a commit that keeps rejected text from a later replacement.useNativeDateRejectionended its rejection on every newvaluein the same way.spec:AST-118FR4 and AR4 forbid.spec:AST-118DEC-14), and a silent discard fails WCAG 2.2 3.3.1 (Error Identification).One internal hook,
Field/useValueReplacesEntry, now holds the rule for DateInput's typed field, its native rejection, and NumberInput. It takes the field'svalueand one signal that changes at each Enter or blur that keeps rejected text, and returns whether a newvaluereplaces the kept entry. Avaluethat arrives in the same update as a change of that signal does not replace the entry. Avaluethat changes in any later update still replaces it.Expected behavior and authority
spec:AST-118FR4, FR6, FR8, and DEC-14: avaluethat the caller passes in the same update as an Enter or blur that keeps rejected text does not replace the kept entry; the text, its rejection, and its message stay, nothing is reported, and a later newvaluereplaces it.spec:AST-118listed the mismatch as "FR4, FR6 gap:DateInputdrops kept date text and its rejection when the caller passes a newvaluein the same update as the Enter or blur that reveals the rejection." This PR removes that line.component:DateInputFR25 states the rule.component:DateTimeInputFR16 sends the date segment to DateInput FR25.family:input-fieldsnamesuseValueReplacesEntryin its Shared owner section, next touseEntryErrorReport.Smallest restoration
packages/core/src/Field/useValueReplacesEntry.ts(new internal hook, not exported): a render-phase record of the lastvalueand keep signal. It returns true in one render per newvalueat most, and false when the keep signal changed in the same update.packages/core/src/DateInput/useTypedDate.ts:useTypedDateField(DateInput and DateTimeInput's date segment) counts each Enter or blur that keeps rejected text and passes that count as the keep signal. A newvaluestill retires the date that typing last reported, so a date typed again after the restore reports again.useNativeDateRejectioncounts each Enter and blur, which shows a refused date that stands, and passes that count.packages/core/src/NumberInput/NumberInput.tsxcalls the same hook with its shown rejection. Each keeping commit sets a new rejection, so behavior does not change. It is a separate commit.useEntryErrorReportis unchanged. Because the rejection does not change, it reports nothing.family:input-fieldsShared owner section andverified_by.Evidence
main'suseTypedDate.ts, give11 failed | 2 passed. The two that pass guard paths that already worked: a date typed again after the restore reports again, and a later newvalueends a native rejection.Scope
Components: DateInput, DateTimeInput, Field (internal hook), NumberInput (internal refactor and comment), Pagination (comment only)
Testing
New tests:
DateInput.test.tsxNativeDateField.test.tsxDateTimeInput.test.tsxField/useValueReplacesEntry.test.tsx: 5 cases (a new value; a value with a new keep signal, then a later value; every keep signal, not only the first; a keep signal alone;Object.isforNaN)Mutation checks. Each row changes the hook or one member in one place. The hook, DateInput, NativeDateField, DateInput calendar, DateTimeInput, NativePickerSegments, NumberInput, Table filtering, and Pagination suites run (1047 tests unmutated). At least one test fails each time.
!==in place ofObject.isNo real-browser run: the change is React state only. It does not depend on layout, pixels, focus order, scrolling, hit testing, or input modality, and the jsdom suites cover it.
Writing rubric results
Records touched:
spec:AST-118(FR4, FR6, FR8, DEC-14, path list, gap list, FR6 verification row),component:DateInput(FR25 and its verification row),component:NumberInput(FR3),component:DateTimeInput(FR16 verification row), andfamily:input-fields(Shared owner section andverified_by).R1 narration: none. The amended FR4, FR6, FR8, and DEC-14 sentences ("an Enter or blur that keeps rejected text", "the first or a later one"), the DateInput FR25 clause, the NumberInput FR3 wording ("any Enter or blur that keeps the rejection"), and the family bullet for
useValueReplacesEntrystate what the system does, in the present tense.R2 research: none.
R3 evidence: the verification cells name test files and cases; none names a pull request, issue, or commit.
R4 rejected alternatives: one, inside DEC-14, one line: "Rejected: sparing only the commit that reveals the rejection, because Enter and then a blur that restores the value would erase the text." It stays because naming it prevents the narrower rule from coming back.
R5 change references: none (searched for
#followed by digits,/pull/, and/issues/).R6 open questions: none.
R7 project status: the
spec:AST-118line "FR4, FR6 gap:DateInputdrops kept date text and its rejection…" is removed, because DateInput and DateTimeInput's date segment keep the entry. No gap is added. The DateInput and DateTimeInput records had no matching gap.