Navigate to previous focusable element with "shift + tab".
Return focus to the input.
Try to use arrows to navigate between cells. The datepicker will change years instead of navigating between cells.
The reason of described behaviour is that the "shift" key still in the pressedKeys set when datepicker input loses focus (by pressing shift+tab) because the keyup event with "shift" key will be fired after the input will lose the focus and onKeyUp input handler will be not fired.
The solution:
Add blur event listener on input on keyboard navigation initialization.
Input blur event handler will clear the pressedKeys set.
This PR fixes the bug in datepicker keyboard navigation.
The sandbox link: https://codesandbox.io/p/sandbox/sweet-pine-pwmcnk
Steps to reproduce:
The reason of described behaviour is that the "shift" key still in the
pressedKeys
set when datepicker input loses focus (by pressing shift+tab) because thekeyup
event with "shift" key will be fired after the input will lose the focus andonKeyUp
input handler will be not fired.The solution:
pressedKeys
set.