fix(DatePicker): error handling & a11y polish - #3395
Conversation
… button - Announce full weekday names in calendar headers instead of abbreviations - Associate the field label with the segment shell via aria-labelledby - Convert the presentational calendar icon to an IconButton with an openCalendarLabel translation Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
View your CI Pipeline Execution ↗ for commit 8839bd2 ☁️ Nx Cloud last updated this comment at |
|
View your CI Pipeline Execution ↗ for commit 81bac52 ☁️ Nx Cloud last updated this comment at |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (49.61%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #3395 +/- ##
==========================================
- Coverage 90.86% 89.64% -1.23%
==========================================
Files 403 276 -127
Lines 6681 5879 -802
Branches 2169 1965 -204
==========================================
- Hits 6071 5270 -801
+ Misses 601 600 -1
Partials 9 9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Move error state to each DatePickerInput so start/end inputs in range mode surface independent messages. Render the error via FormError's `absolute` variant so it sits out of layout flow — the input never changes height, keeping the range-mode arrow aligned and reserving no space when there is no error. The calendar popover still shifts down (y=0) only when open and an error exists, via a boolean `hasError` context signal. Validate typed dates (incomplete, invalid month/day, rollover, disabled dates) through a shared validateSegments util and localizable translation keys. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wire validateDateRange into the typed-commit path so a range spanning a disabled date shows an error instead of silently resetting; dedupe its span check onto rangeContainsDisabled. Also clean up pre-existing lint. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
📬 Published Alpha Packages:
|
|
🚀 Styleguide deploy preview ready! Preview URL: https://6a7c8c9bcfe1a15c1ac82913--gamut-preview.netlify.app |
Overview
Adds per-input validation error messages to
DatePicker:DatePickerInputmanages its own error, so range mode shows independent messages for the start and end inputs. Typed dates are validated on change and blur; invalid input stays visible until corrected.FormError'sabsolutevariant so the input never changes height: the range-mode arrow stays aligned and no space is reserved when there's no error.hasErrorcontext flag); closed-state spacing is unchanged.DatePickerTranslationskeys for each error message, with English defaults.Also adds some calendar/input accessibility refinements:
openCalendarLabeltranslationThere are definitely some bugs so let me know what you find! Also lmk what the error messages should be and if we want any more generic.
PR Checklist
Testing Instructions
Single mode
2/30/2024and blur → shows "February does not have 30 days".2/28/2024→ error clears and the date commits.disableDateprop, type a disabled date → shows "This date is not available".Range mode
2/30/2024→ error appears under the start input only.Calendar + spacing
Accessibility
role="alert"region; start/end errors announce independently.aria-invalidtoggles on each input as its error state changes.PR Links and Envs