diff options
| author | Stephen Blott | 2017-04-13 15:28:43 +0100 |
|---|---|---|
| committer | Stephen Blott | 2017-04-18 05:50:51 +0100 |
| commit | ee83d1a9603a304c9328d3587e2db829fcec7aaf (patch) | |
| tree | 57b0bda7ab9f71e6b0e560a84c90ea5cb33efc46 /lib | |
| parent | d03845e3151babbd63cf13e9e3d74d98351671f9 (diff) | |
| download | vimium-ee83d1a9603a304c9328d3587e2db829fcec7aaf.tar.bz2 | |
Ignore keybiard repeats.
Keyboard repeats were interfering with smooth scrolling. But we should
be ignoreing them anyway.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dom_utils.coffee | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index df9ca390..8764bdbe 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -318,19 +318,20 @@ DomUtils = consumeKeyup: (event, callback = null) -> @suppressEvent event keyChar = KeyboardUtils.getKeyCharString event - handlerStack.push - _name: "dom_utils/consumeKeyup" - keydown: (event) -> - @remove() - handlerStack.continueBubbling - keyup: (event) -> - return handlerStack.continueBubbling unless keyChar == KeyboardUtils.getKeyCharString event - @remove() - handlerStack.suppressEvent - # We cannot track keyup events if we lose the focus. - blur: (event) -> - @remove() if event.target == window - handlerStack.continueBubbling + unless event.repeat + handlerStack.push + _name: "dom_utils/consumeKeyup" + keydown: (event) -> + @remove() + handlerStack.continueBubbling + keyup: (event) -> + return handlerStack.continueBubbling unless keyChar == KeyboardUtils.getKeyCharString event + @remove() + handlerStack.suppressEvent + # We cannot track keyup events if we lose the focus. + blur: (event) -> + @remove() if event.target == window + handlerStack.continueBubbling callback?() handlerStack.suppressEvent |
