-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
When custom dateFilter functions are used to control which dates can be selected for the start and end dates on a mat-date-range-input, the keyboard focus is lost/reset after the user selects a start date. They must tab several times to get back to the right place so they can select their end date.
Note I'm dynamically switching between two different dateFilter functions, depending on which date is being selected.
This issue is causing us to fail our accessibility audit.
Reproduction
StackBlitz link: https://stackblitz.com/edit/4yvmaz?file=src%2Fexample%2Fdate-range-picker-overview-example.html
Steps to reproduce:
- In the Custom Date Filters Example, tab to the calendar icon and open it with Enter
- Use arrow keys to navigate the calendar and hit Enter to select a start date
- Notice the arrow keys now do nothing and you are unable to select an end date with the keyboard unless you tab several times and find the right place again.
Expected Behavior
The Custom Date Filters Example provided should work exactly like the Basic Example. After selecting a start date, you should be able to use the arrows and Enter key again to select an end date.
Actual Behavior
Focus seems to be lost or reset after the first date is selected.
I thought it might be related to the fact that the date that currently has focus (the selected start date) gets disabled in my example due to my end date requirements. But even if I allow the start date as a valid end date, the problem persists.
Environment
- Angular: Seems to be all versions, tested here with 18.0.3
- CDK/Material: Seems to be all versions, tested here with 18.0.3
- Browser(s): Confirmed in Chrome, Edge and Firefox
- Operating System (e.g. Windows, macOS, Ubuntu): Windows