From 1211e6f99dbbb19ba3346def2ae2799ba0831cdd Mon Sep 17 00:00:00 2001 From: rutkat Date: Tue, 28 Oct 2014 14:00:31 -0700 Subject: [PATCH] Changed keyup to keydown for more responive key listeners. closes #1545, closes #1616 --- src/js/menu.js | 2 +- src/js/slider.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/menu.js b/src/js/menu.js index ac5c3691ef..189598a8e6 100644 --- a/src/js/menu.js +++ b/src/js/menu.js @@ -111,7 +111,7 @@ vjs.MenuButton = vjs.Button.extend({ this.hide(); } - this.on('keyup', this.onKeyPress); + this.on('keydown', this.onKeyPress); this.el_.setAttribute('aria-haspopup', true); this.el_.setAttribute('role', 'button'); } diff --git a/src/js/slider.js b/src/js/slider.js index 72b03eae51..d5caf8f076 100644 --- a/src/js/slider.js +++ b/src/js/slider.js @@ -36,7 +36,7 @@ vjs.Slider.prototype.dispose = function() { vjs.off(document, 'mouseup', this.boundEvents.end, false); vjs.off(document, 'touchmove', this.boundEvents.move, false); vjs.off(document, 'touchend', this.boundEvents.end, false); - + vjs.off(document, 'keydown', vjs.bind(this, this.onKeyPress)); vjs.off(document, 'keyup', vjs.bind(this, this.onKeyPress)); vjs.Component.prototype.dispose.call(this); @@ -187,7 +187,7 @@ vjs.Slider.prototype.calculateDistance = function(event){ }; vjs.Slider.prototype.onFocus = function(){ - vjs.on(document, 'keyup', vjs.bind(this, this.onKeyPress)); + vjs.on(document, 'keydown', vjs.bind(this, this.onKeyPress)); }; vjs.Slider.prototype.onKeyPress = function(event){