Skip to content

Commit

Permalink
fix: enable keyboard controls on menu items (#8777)
Browse files Browse the repository at this point in the history
## Description

This fix addresses an issue that was introduced in this
[refactor](35de64c#diff-9fd94576fe3b609171a426feb961b0954d70c8c14e598024d49ae9c8836a71ca).
At the moment, all key down events that are supposed to interact with
the `menu-item` component are now being ignored, meaning you are unable
to interact with most of the menu items in the control bar (e.g.
captions settings). This PR fixes that by only ignoring key down events
that are normally ignored by the `menu-item`.

## Requirements Checklist
- [x] Feature implemented / Bug fixed
- [ ] If necessary, more likely in a feature request than a bug fix
- [ ] Change has been verified in an actual browser (Chrome, Firefox,
IE)
  - [ ] Unit Tests updated or fixed
  - [ ] Docs/guides updated
- [ ] Example created ([starter template on
JSBin](https://codepen.io/gkatsev/pen/GwZegv?editors=1000#0))
- [ ] Has no DOM changes which impact accessiblilty or trigger warnings
(e.g. Chrome issues tab)
  - [ ] Has no changes to JSDoc which cause `npm run docs:api` to error
- [ ] Reviewed by Two Core Contributors
  • Loading branch information
usmanonazim authored Jun 24, 2024
1 parent fa9c41c commit 04b9bb2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/menu/menu-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class MenuItem extends ClickableComponent {
* @listens keydown
*/
handleKeyDown(event) {
if (['Tab', 'Escape', 'ArrowUp', 'ArrowLeft', 'ArrowRight', 'ArrowDown'].includes(event.key)) {
if (!['Tab', 'Escape', 'ArrowUp', 'ArrowLeft', 'ArrowRight', 'ArrowDown'].includes(event.key)) {
// Pass keydown handling up for unused keys
super.handleKeyDown(event);
}
Expand Down

0 comments on commit 04b9bb2

Please sign in to comment.