Skip to content

fix(DateRangeInput): expose trigger as combobox - #4689

Open
AKnassa wants to merge 1 commit into
facebook:mainfrom
AKnassa:rocky/issue-4681-aria-allowed-attr
Open

fix(DateRangeInput): expose trigger as combobox#4689
AKnassa wants to merge 1 commit into
facebook:mainfrom
AKnassa:rocky/issue-4681-aria-allowed-attr

Conversation

@AKnassa

@AKnassa AKnassa commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Part of #4681 (weekly a11y scan). Clears the critical DateRangeInput::Required::aria-allowed-attr baseline entry.

What this does

The date range picker's trigger button carried aria-required, which ARIA does not allow on role=button, so axe flagged it as critical. The trigger is now exposed as role="combobox", the same decision DateInput and DateTimeInput already made for their triggers, which makes aria-required and aria-invalid legal and announces the control as what it behaves like: a collapsed picker that opens a dialog.

What changed

  • role="combobox" on the trigger button in DateRangeInput.tsx. The existing aria-expanded, aria-haspopup="dialog" and aria-controls wiring already matches the pattern.
  • Trigger test queries move from button-role to combobox-role. The accessible name (label plus value or placeholder) is pinned by name-matched assertions and is mutation-proven: removing the trigger's aria-label fails 2 tests.
  • Baseline: 1 entry removed, deletions only.
  • Changeset (patch): consumers who query the trigger with getByRole('button', {name}) need to target combobox instead; screen readers now announce "combobox, collapsed" rather than "button".

Considered and rejected

Dropping aria-required from the button was the smaller diff, but it silently removes the required announcement and diverges from both sibling date inputs.

Not in this PR

The 10 remaining aria-allowed-attr entries (ChatComposerInput x8, ChatLayout x2) all trace to one node: the composer's editable div flips to role=combobox when triggers are configured while keeping a hardcoded aria-multiline. That file is owned by open PR #4074; the fix belongs there and the entries stay baselined until it lands.

Verification

41/41 DateRangeInput tests (plus width-contract and status-icon suites, 85/85), eslint clean, and the repo's axe audit with --fail-on-new: 0 issues across all 17 DateRangeInput stories.

axe flagged aria-required on the trigger (critical aria-allowed-attr):
the attribute is not allowed on role=button. DateInput and DateTimeInput
already expose their triggers as role=combobox with aria-haspopup=dialog,
so this aligns DateRangeInput with the sibling decision instead of
silently dropping the required announcement.

Trigger tests move to combobox-role queries; the accessible name
(label + value/placeholder) is pinned by name-matched assertions,
mutation-proven against aria-label removal. Baseline: -1 entry.

Verified: 41/41 tests, eslint clean, axe audit 0 issues across all
17 DateRangeInput stories with --fail-on-new.

Part of facebook#4681.
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Aug 3, 2026 9:43pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 3, 2026
@AKnassa
AKnassa marked this pull request as ready for review August 4, 2026 01:48
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.

1 participant