Open talatkuyuk opened 1 year ago
Yes having the same issue. Please fix. Thank you!
There is no need to add a button as there is already logic to set tabindex, but currently it is possible that no date has tabindex=0 if the datepicker loads with no selected date.
https://github.com/Hacker0x01/react-datepicker/blob/master/src/day.jsx#L282
So if not keyboardSelected/selected/preselected it should default to today or first day of the month.
Here's a solution
const datePickerRef = useRef(null);
useEffect(() => {
if (datePickerRef.current) {
datePickerRef.current.setPreSelection(new Date());
}
}, [datePickerRef]);
<DatePicker ref={datePickerRef} />
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 10 days.
The problem is: The keyboard users can not focus to the Today Button (actually it is a
div
) viaTab
key.Today button's tab index (tabIndex) actually should be set to 0. Otherwise it is not accessible from keyboard.
https://github.com/Hacker0x01/react-datepicker/blob/master/src/calendar.jsx#L734