spectrum-web-components
spectrum-web-components copied to clipboard
[Bug]: sp-menu does not honor Numpad keys for Arrow ⬆️ ⬇️ and Enter
trafficstars
Code of conduct
- [X] I agree to follow this project's code of conduct.
Impacted component(s)
Menu
Expected behavior
Similar to how sp-menu supports navigating across with the help of keyboard arrow keys, it should also support Numpad arrow. Numpad Enter key also should work similar to the main Enter key.
Actual behavior
Numpad keys are not handled at all.
Screenshots
No response
What browsers are you seeing the problem in?
Chrome
How can we reproduce this issue?
- Go to storybook menu item page
- Click on the first menu item
- Using keyboard having numpad, use the ⬆️ ⬇️ keys of the numpad region
- Observe the active menu item doesn't change
- Press enter key from the numpad section
- Notice the menu item is not selected
Sample code that illustrates the problem
No response
Logs taken while reproducing problem
No response
I can see the issue in https://github.com/adobe/spectrum-web-components/blob/main/packages/menu/src/Menu.ts, where instead of using event.code if event.key is used, this would be fixed.