react-magma
react-magma copied to clipboard
fix(Date Picker): Automatically focus today or min date on open state.
Closes: #2117
What I did
- Added automatic focus on today.
- Added automatic focus on min date.
- Pressing on the
Todaybutton forces focus on today. - Refactor code, fix extra focus on the month wrapper.
Screenshots
Checklist
- [x] changeset has been added
- [x] Pull request is assigned, labels have been added and ticket is linked
- [x] Pull request description is descriptive and testing steps are listed
- [ ] Corresponding changes to the documentation have been made
- [x] New and existing unit tests pass locally with the proposed changes
- [x] Tests that prove the fix is effective or that the feature works have been added
How to test
Go to Storybook -> Date Picker -> Default -> open Calendar -> current day should be focused
Go to Storybook -> Date Picker -> Default -> Open Calendar -> change the month or year -> click on the Today button -> the current day should be focused.
Go to Storybook -> Date Picker -> Default -> set min date like 11/11/2025 -> Open Calendar -> go to November -> min date should be focused
Go to Storybook -> Date Picker -> Default -> type date like 11/11/2022 -> set min date like 11/11/2025 -> Open Calendar -> go to November -> chosen date should be focused but disabled.