1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-21 01:39:04 +02:00

fix: enable keyboard controls on menu items (#8777)

## Description

This fix addresses an issue that was introduced in this
[refactor](35de64ceb0 (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
This commit is contained in:
Usman Omar 2024-06-24 11:19:59 +01:00 committed by GitHub
parent fa9c41c866
commit 04b9bb27bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
}