diff options
| author | mrmr1993 | 2017-11-09 14:06:50 +0000 |
|---|---|---|
| committer | mrmr1993 | 2017-11-09 14:45:07 +0000 |
| commit | ac3310d23fa0367b6130a4b05fe41192410fadb3 (patch) | |
| tree | dcbf2ffc9cb51b34daf42295cdd370336e44033c /lib | |
| parent | 177db4d6b07615bc7891512b90568255933db53b (diff) | |
| download | vimium-ac3310d23fa0367b6130a4b05fe41192410fadb3.tar.bz2 | |
Suppress propagation for keyup events when we have for keydown events
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dom_utils.coffee | 7 | ||||
| -rw-r--r-- | lib/handler_stack.coffee | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index d8a5d203..95b9f4b3 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -344,7 +344,7 @@ DomUtils = consumeKeyup: do -> handlerId = null - (event, callback = null) -> + (event, callback = null, suppressPropagation) -> unless event.repeat handlerStack.remove handlerId if handlerId? code = event.code @@ -353,7 +353,10 @@ DomUtils = keyup: (event) -> return handlerStack.continueBubbling unless event.code == code @remove() - DomUtils.suppressEvent event + if suppressPropagation + DomUtils.suppressPropagation event + else + DomUtils.suppressEvent event handlerStack.continueBubbling # We cannot track keyup events if we lose the focus. blur: (event) -> diff --git a/lib/handler_stack.coffee b/lib/handler_stack.coffee index 646ddfbd..a43fc356 100644 --- a/lib/handler_stack.coffee +++ b/lib/handler_stack.coffee @@ -57,7 +57,10 @@ class HandlerStack if result == @passEventToPage return true else if result == @suppressPropagation - DomUtils.suppressPropagation event + if type == "keydown" + DomUtils.consumeKeyup event, null, true + else + DomUtils.suppressPropagation event return false else if result == @restartBubbling return @bubbleEvent type, event |
