aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authormrmr19932014-11-02 05:39:07 +0000
committermrmr19932014-11-02 05:39:07 +0000
commitdafa166364ff9a30b0cc2f0d160fcbcfc01cc61e (patch)
tree164fb44f28097d5920793c16d55966a9880421b3 /tests
parent8afdaabd2e66a3092bc2b122443956327e0ba679 (diff)
downloadvimium-dafa166364ff9a30b0cc2f0d160fcbcfc01cc61e.tar.bz2
Force our key event handlers to have the highest possible priority
* The `window` object receives key events before the `document` object, and so any event listeners on `window` get priority. This commit switches from binding `keydown`, `keypress`, `keyup` on `document` to on `window`. * We were using `event.stopPropagation()` to prevent other event listeners from firing if we had handled an event. This stopped the event from propagating to other elements/objects and triggering their event listeners, but didn't block event listeners registered on the same object as ours. Switching to `event.stopImmediatePropagation()` ensures that our event listener is the last to run for the event. Fixing these issues allows Vimium to regain control over key events in Google Groups (eg. the [vimium-dev group](https://groups.google.com/forum/vimium-dev)).
Diffstat (limited to 'tests')
-rw-r--r--tests/dom_tests/dom_tests.coffee2
-rw-r--r--tests/dom_tests/vomnibar_test.coffee2
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/dom_tests/dom_tests.coffee b/tests/dom_tests/dom_tests.coffee
index ac3f9ebe..4a61877c 100644
--- a/tests/dom_tests/dom_tests.coffee
+++ b/tests/dom_tests/dom_tests.coffee
@@ -8,7 +8,7 @@ mockKeyboardEvent = (keyChar) ->
event.charCode = (if keyCodes[keyChar] isnt undefined then keyCodes[keyChar] else keyChar.charCodeAt(0))
event.keyIdentifier = "U+00" + event.charCode.toString(16)
event.keyCode = event.charCode
- event.stopPropagation = ->
+ event.stopImmediatePropagation = ->
event.preventDefault = ->
event
diff --git a/tests/dom_tests/vomnibar_test.coffee b/tests/dom_tests/vomnibar_test.coffee
index dc2a849f..b414fdfb 100644
--- a/tests/dom_tests/vomnibar_test.coffee
+++ b/tests/dom_tests/vomnibar_test.coffee
@@ -52,7 +52,7 @@ context "Keep selection within bounds",
eventMock =
preventDefault: ->
- stopPropagation: ->
+ stopImmediatePropagation: ->
@completions = [{html:'foo',type:'tab',url:'http://example.com'}]
ui.update(true)