Skip to content

fix(DateInput): hardening — swarm findings - #772

Merged
josephfarina merged 6 commits into
mainfrom
navi/hardening/dateinput
Mar 24, 2026
Merged

fix(DateInput): hardening — swarm findings#772
josephfarina merged 6 commits into
mainfrom
navi/hardening/dateinput

Conversation

@josephfarina

@josephfarina josephfarina commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Hardening fixes for XDSDateInput and dateParser.

Changes

DateInput component

  • isEffectivelyDisabled: input disabled during isBusy (prevents interaction during async updates)
  • Constraint validation on text input via isDateDisabled (previously only calendar enforced min/max)
  • ARIA combobox role: role="combobox", aria-expanded, aria-haspopup="dialog", aria-controls
  • Enter key commits typed date (same as blur behavior)
  • ArrowDown opens calendar popover (APG combobox pattern)
  • Fix pendingInput not cleared by self-triggered value changes (typing kept getting overwritten by formatted date)
  • Calendar shows optimisticValue instead of stale value
  • Clear pending input on external value change via useEffect
  • ISO format regex guard on displayValue

dateParser

  • Fix years 0-99 mapping to 1900s (date.setFullYear(year) after construction)
  • Reject mixed separators (e.g. 1/25.2026 → null)
  • 4-digit year padding in dateToISO

Tests

  • 4 new tests: year 0-99 preservation, mixed separator rejection, Enter key commit, ArrowDown opens popover

Screenshots

Story Screenshot
Default default
With Value with-value
Disabled disabled
Min/Max min-max
Two Month two-month
Error Status error
All Variations all

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 20, 2026
@github-actions

github-actions Bot commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

DateInput · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 848B N/A
Lines of Code N/A 413 -
Complexity N/A Very High (57) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@xds/core 11.0KB 17.6KB 2.7KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@cixzhang cixzhang 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.

Hardening review:

Remove ArrowDown/Alt+ArrowDown keyboard shortcut to open calendar from input. The calendar already has an open mechanism (icon button), and this shortcut is incomplete without also moving focus into the calendar grid.

@josephfarina
josephfarina force-pushed the navi/hardening/dateinput branch 3 times, most recently from 6f5c002 to dd9d245 Compare March 24, 2026 19:35
@josephfarina
josephfarina marked this pull request as ready for review March 24, 2026 19:39
@josephfarina
josephfarina force-pushed the navi/hardening/dateinput branch from dd9d245 to 77b3124 Compare March 24, 2026 20:34
@josephfarina

Copy link
Copy Markdown
Contributor Author

Removed the ArrowDown shortcut and its test per Cindy's review. Good call, it was incomplete without focus management into the calendar grid.

@josephfarina
josephfarina merged commit e276549 into main Mar 24, 2026
13 checks passed
@cixzhang
cixzhang deleted the navi/hardening/dateinput branch April 9, 2026 14:33
cixzhang pushed a commit that referenced this pull request Apr 26, 2026
* fix(DateInput): hardening — swarm findings

* fix(DateInput): swarm fixes — verified findings

* review: apply API guidance per Cindy review

* cleanup: strip noise from hardening PR

* test(DateInput): add failing tests for parser bugs and keyboard handling

* fix(DateInput): parser bugs + keyboard handling

---------

Co-authored-by: Joey Farina <joeyfarina@fb.com>
cixzhang pushed a commit that referenced this pull request Jun 21, 2026
* fix(DateInput): hardening — swarm findings

* fix(DateInput): swarm fixes — verified findings

* review: apply API guidance per Cindy review

* cleanup: strip noise from hardening PR

* test(DateInput): add failing tests for parser bugs and keyboard handling

* fix(DateInput): parser bugs + keyboard handling

---------

Co-authored-by: Joey Farina <joeyfarina@fb.com>
cixzhang pushed a commit that referenced this pull request Jun 21, 2026
* fix(DateInput): hardening — swarm findings

* fix(DateInput): swarm fixes — verified findings

* review: apply API guidance per Cindy review

* cleanup: strip noise from hardening PR

* test(DateInput): add failing tests for parser bugs and keyboard handling

* fix(DateInput): parser bugs + keyboard handling

---------

Co-authored-by: Joey Farina <joeyfarina@fb.com>
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.

2 participants