[Accessibility] Focus jumps to start date after selecting end date in date range picker
Describe the bug After using keyboard navigation to select an end date to complete a date range, focus unexpectedly moves to the start date of the range instead of remaining on the end date that was just selected. This breaks expected focus management behavior and disorients keyboard and screen reader users.
To Reproduce Steps to reproduce the behavior:
- Go to https://reactdatepicker.com/#example-date-range-in-a-single-datepicker
- Navigate to "Date Range in a Single Datepicker" example using keyboard
- Navigate to a start date using arrow keys and confirm with
EnterorSpace - Navigate to an end date using arrow keys and confirm with
EnterorSpace - Observe that focus moves to the start date instead of staying on the end date
Expected behavior After confirming the end date, focus should remain on the end date.
Screenshots
https://github.com/user-attachments/assets/e1e32ed0-6875-4fee-ac5c-6e85e1c6a596
Desktop (please complete the following information):
- OS: macOS
- Browser: Chrome
Additional context Moving focus away from the last interacted element without user expectation may violate WCAG 2.4.3 Focus Order (Level A), which requires that focus order preserves meaning and operability, as well as WCAG 3.2.2 On Input (Level A), which requires that user input does not trigger unexpected changes of context, including changes of focus.
Source: Hacker0x01/react-datepicker