mirror of
https://github.com/videojs/video.js.git
synced 2024-12-23 02:04:34 +02:00
hide menu button on click after hover
This commit is contained in:
parent
bf1d9f307d
commit
2dcada103c
@ -58,11 +58,7 @@ class MenuButton extends Component {
|
|||||||
this.on(this.menuButton_, 'tap', handleClick);
|
this.on(this.menuButton_, 'tap', handleClick);
|
||||||
this.on(this.menuButton_, 'click', handleClick);
|
this.on(this.menuButton_, 'click', handleClick);
|
||||||
this.on(this.menuButton_, 'keydown', (e) => this.handleKeyDown(e));
|
this.on(this.menuButton_, 'keydown', (e) => this.handleKeyDown(e));
|
||||||
this.on(this.menuButton_, 'mouseenter', () => {
|
this.on('mouseenter', (e) => this.handleMouseEnter(e));
|
||||||
this.addClass('vjs-hover');
|
|
||||||
this.menu.show();
|
|
||||||
Events.on(document, 'keyup', this.handleMenuKeyUp_);
|
|
||||||
});
|
|
||||||
this.on('mouseleave', (e) => this.handleMouseLeave(e));
|
this.on('mouseleave', (e) => this.handleMouseLeave(e));
|
||||||
this.on('keydown', (e) => this.handleSubmenuKeyDown(e));
|
this.on('keydown', (e) => this.handleSubmenuKeyDown(e));
|
||||||
}
|
}
|
||||||
@ -263,6 +259,20 @@ class MenuButton extends Component {
|
|||||||
Events.off(document, 'keyup', this.handleMenuKeyUp_);
|
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
|
* Set the focus to the actual button, not to this element
|
||||||
*/
|
*/
|
||||||
|
13
test/unit/menu/menu-button.test.js
Normal file
13
test/unit/menu/menu-button.test.js
Normal 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();
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user