react-datepicker icon indicating copy to clipboard operation
react-datepicker copied to clipboard

showYearDropdown and showMonthYearDropdown are not accessible via keyboard

Open Lizzy-Gallagher opened this issue 8 months ago • 0 comments

Describe the bug Year (showYearDropdown=true) and month-year (showMonthYearDropdown=true) dropdowns are not accessible via keyboard

To Reproduce Steps to reproduce the behavior:

  • Go to https://codesandbox.io/s/zen-tesla-86xt77?file=/src/App.js:514-535
  • Tab into either datepicker input field.
  • When the calendar popup appears, start tabbing through the elements.

You will not be able to tab into the year or month dropdowns

Expected behavior You can tab to the year/month-year dropdown as well as the calendar days, previous month, next month.

Additional context This was found during an a11y audit, here's the text of their finding:

Issue: The dropdowns for selecting Month/Year within the datepicker are not keyboard accessible. When focused on the screen reader using the arrow keys, they are announced without a role. Why it matters: Proper implementation of a combobox ensures that screen reader users and those relying on keyboard navigation can perceive and operate its functionality effectively. This enables all users to select options smoothly. How to fix it: Consider implementing the control as a single-selection combobox. Use the WAI-ARIA examples and patterns as a reference for proper implementation.

This is a rereport of https://github.com/Hacker0x01/react-datepicker/issues/4127

Lizzy-Gallagher avatar May 06 '25 13:05 Lizzy-Gallagher