@@ -9,7 +9,6 @@ import * as Events from '../utils/events.js';
99import { toTitleCase } from '../utils/str.js' ;
1010import { IS_IOS } from '../utils/browser.js' ;
1111import document from 'global/document' ;
12- import keycode from 'keycode' ;
1312
1413/** @import Player from '../player' */
1514
@@ -298,19 +297,19 @@ class MenuButton extends Component {
298297 handleKeyDown ( event ) {
299298
300299 // Escape or Tab unpress the 'button'
301- if ( keycode . isEventKey ( event , 'Esc' ) || keycode . isEventKey ( event , 'Tab' ) ) {
300+ if ( event . key === 'Esc' || event . key === 'Tab' ) {
302301 if ( this . buttonPressed_ ) {
303302 this . unpressButton ( ) ;
304303 }
305304
306305 // Don't preventDefault for Tab key - we still want to lose focus
307- if ( ! keycode . isEventKey ( event , 'Tab' ) ) {
306+ if ( ! event . key === 'Tab' ) {
308307 event . preventDefault ( ) ;
309308 // Set focus back to the menu button's button
310309 this . menuButton_ . focus ( ) ;
311310 }
312311 // Up Arrow or Down Arrow also 'press' the button to open the menu
313- } else if ( ( keycode . isEventKey ( event , 'Up' ) || keycode . isEventKey ( event , 'Down' ) ) && ! ( this . player_ . options_ . playerOptions . spatialNavigation && this . player_ . options_ . playerOptions . spatialNavigation . enabled ) ) {
312+ } else if ( ( event . key === 'Up' ) || event . key === 'Down' && ! ( this . player_ . options_ . playerOptions . spatialNavigation && this . player_ . options_ . playerOptions . spatialNavigation . enabled ) ) {
314313 if ( ! this . buttonPressed_ ) {
315314 event . preventDefault ( ) ;
316315 this . pressButton ( ) ;
@@ -329,7 +328,7 @@ class MenuButton extends Component {
329328 */
330329 handleMenuKeyUp ( event ) {
331330 // Escape hides popup menu
332- if ( keycode . isEventKey ( event , 'Esc' ) || keycode . isEventKey ( event , 'Tab' ) ) {
331+ if ( event . key === 'Esc' || event . key === 'Tab' ) {
333332 this . removeClass ( 'vjs-hover' ) ;
334333 }
335334 }
@@ -357,12 +356,12 @@ class MenuButton extends Component {
357356 */
358357 handleSubmenuKeyDown ( event ) {
359358 // Escape or Tab unpress the 'button'
360- if ( keycode . isEventKey ( event , 'Esc' ) || keycode . isEventKey ( event , 'Tab' ) ) {
359+ if ( event . key === 'Esc' || event . key === 'Tab' ) {
361360 if ( this . buttonPressed_ ) {
362361 this . unpressButton ( ) ;
363362 }
364363 // Don't preventDefault for Tab key - we still want to lose focus
365- if ( ! keycode . isEventKey ( event , 'Tab' ) ) {
364+ if ( ! event . key === 'Tab' ) {
366365 event . preventDefault ( ) ;
367366 // Set focus back to the menu button's button
368367 this . menuButton_ . focus ( ) ;
0 commit comments