fix(widgets): clear stale date validation UI on form clear#14066
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
There was a problem hiding this comment.
Pull request overview
Fixes a UX issue in the frontend widget layer where DateInput / DateTimeInput validation errors could remain visible after a clear_on_submit form clear, by ensuring local UI error state is reset when the form is cleared.
Changes:
DateTimeInput: initializependingDatefrom the same initial committed value logic, and resetpendingDateon form clear so the derived validation error UI disappears.DateInput: wireonFormClearedto clear the localerrorstate, and refactor error-reset into a small callback.- Add unit tests for both widgets verifying validation errors are cleared after form submission/clear.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| frontend/lib/src/components/widgets/DateTimeInput/DateTimeInput.tsx | Resets pendingDate on form clear and refactors initial pendingDate initialization to avoid relying on post-hook committed state. |
| frontend/lib/src/components/widgets/DateTimeInput/DateTimeInput.test.tsx | Adds coverage ensuring the validation tooltip disappears after a clear-on-submit form clear. |
| frontend/lib/src/components/widgets/DateInput/DateInput.tsx | Clears local error state via onFormCleared to prevent stale validation UI after form clear. |
| frontend/lib/src/components/widgets/DateInput/DateInput.test.tsx | Adds coverage ensuring the validation tooltip disappears after a clear-on-submit form clear. |
Consolidated Code Review: PR #14066 — fix(widgets): clear stale date validation UI on form clearSummaryThis PR fixes a bug (#14052) where validation error states (red border, error tooltip) persist in The fix registers Changed files:
Reviewer ConsensusBoth reviewers ( Code QualityAgreement: Both reviewers agree the implementation is clean and follows existing widget-state patterns (e.g., DateInput.tsx — Minimal and well-structured. The DateTimeInput.tsx — The changes are sound but more involved. The One subtle behavioral difference: Test CoverageAgreement: Both reviewers found the unit test coverage solid and the test patterns appropriate. Both new tests follow a well-structured pattern:
The tests use proper RTL patterns: Agreement on gap: Both reviewers note the absence of dedicated E2E tests for this specific regression scenario. Both consider this acceptable for a focused bug fix but recommend E2E coverage as a follow-up. Backwards CompatibilityAgreement: No API or protocol changes. The Security & RiskAgreement: No security concerns. Changes are purely client-side UI state management. Regression risk is low and localized to form-clear flows. AccessibilityAgreement: No accessibility impact. Error display mechanisms (including ARIA patterns via Recommendations
VerdictAPPROVED — Clean, well-tested bug fix that correctly addresses stale validation error states on form clear, following established patterns. Both reviewers agree it is ready to merge. The recommendations above are non-blocking improvements. Missing ReviewsNone — both expected models ( Consolidated review by 📋 Review by `gpt-5.3-codex-high`SummaryThis PR fixes stale validation UI in Code QualityThe implementation is clean and follows existing widget-state patterns:
Test CoverageCoverage is good at the unit-test layer for the regression:
Backwards CompatibilityNo API or protocol changes were introduced. Behavior changes are limited to client-side UI state reset in form-clear flows and are backwards compatible with expected Security & RiskNo security concerns identified. Regression risk is low and localized to frontend widget state synchronization during form-clear events. AccessibilityNo new accessibility issues identified in the diff. The change does not alter keyboard interaction patterns, semantics, or accessible naming. Recommendations
VerdictAPPROVED: The fix is targeted, low-risk, and adequately validated with unit tests; it is ready to merge. This is an automated AI review by 📋 Review by `opus-4.6-thinking`SummaryThis PR fixes a bug where validation error states (red border, error tooltip) persist in Changed files:
Code QualityDateInput.tsx — Clean and minimal. The DateTimeInput.tsx — The changes are sound but more involved:
Test CoverageBoth new tests follow a solid pattern:
The tests use appropriate RTL patterns: Minor gap: There are no E2E tests for this scenario. Given this is a focused bug fix with good unit test coverage, this is acceptable, but E2E coverage for date validation in Backwards CompatibilityNo breaking changes. The Security & RiskNo security concerns. The changes are purely UI state management (clearing local React state on form clear). No new data flows, network calls, or user data handling introduced. Regression risk: Low. The DateInput change is minimal (just clearing AccessibilityNo accessibility impact. The changes only affect when error states are cleared, not how they are displayed. The error tooltip mechanism (which uses proper ARIA patterns via Recommendations
VerdictAPPROVED: Clean, well-tested bug fix that correctly clears stale validation error states on form clear, following established patterns from other widgets (e.g., This is an automated AI review by |
When clear_on_submit resets date widgets to their defaults, local validation state can remain stale because the normal change handler may not run if the committed value is unchanged. Add explicit onFormCleared handling to reset local widget state in DateInput and DateTimeInput, and add regression tests for invalid in-form values with non-empty defaults to verify that error UI is cleared after form submission.
3fda6f6 to
6fdde49
Compare

Describe your changes
Fixed validation error state persistence in DateInput and DateTimeInput widgets when forms are cleared. Previously, validation errors would remain visible even after form submission/clearing, creating a confusing user experience. Now both widgets properly reset their error states when the form is cleared through the
onFormClearedcallback.For DateTimeInput, also refactored the initialization logic to ensure
pendingDateis properly initialized with the correct initial value instead of relying on the committed date state.GitHub Issue Link (if applicable)
Fixes #14052
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.