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

hide menu button on click after hover

This commit is contained in:
usmanonazim 2023-03-21 11:42:23 +00:00
parent bf1d9f307d
commit 2dcada103c
2 changed files with 28 additions and 5 deletions

View File

@ -58,11 +58,7 @@ class MenuButton extends Component {
this.on(this.menuButton_, 'tap', handleClick);
this.on(this.menuButton_, 'click', handleClick);
this.on(this.menuButton_, 'keydown', (e) => this.handleKeyDown(e));
this.on(this.menuButton_, 'mouseenter', () => {
this.addClass('vjs-hover');
this.menu.show();
Events.on(document, 'keyup', this.handleMenuKeyUp_);
});
this.on('mouseenter', (e) => this.handleMouseEnter(e));
this.on('mouseleave', (e) => this.handleMouseLeave(e));
this.on('keydown', (e) => this.handleSubmenuKeyDown(e));
}
@ -263,6 +259,20 @@ class MenuButton extends Component {
Events.off(document, 'keyup', this.handleMenuKeyUp_);
}
/**
*
* @param {Event} event
* The `mouseenter` event that caused this function to be called.
*
* @listens mouseenter
*/
handleMouseEnter(event) {
this.addClass('vjs-hover');
this.buttonPressed_ = true;
this.menu.show();
Events.on(document, 'keyup', this.handleMenuKeyUp_);
}
/**
* Set the focus to the actual button, not to this element
*/

View File

@ -0,0 +1,13 @@
/* eslint-env qunit */
import TestHelpers from '../test-helpers.js';
QUnit.module('MenuButton', {
beforeEach(assert) {
this.player = TestHelpers.makePlayer({
});
},
afterEach(assert) {
this.player.dispose();
}
});