From dafa166364ff9a30b0cc2f0d160fcbcfc01cc61e Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Sun, 2 Nov 2014 05:39:07 +0000 Subject: 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)). --- content_scripts/vomnibar.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'content_scripts/vomnibar.coffee') diff --git a/content_scripts/vomnibar.coffee b/content_scripts/vomnibar.coffee index 22b9ed64..8c6b2059 100644 --- a/content_scripts/vomnibar.coffee +++ b/content_scripts/vomnibar.coffee @@ -139,7 +139,7 @@ class VomnibarUI @hide() # It seems like we have to manually suppress the event here and still return true. - event.stopPropagation() + event.stopImmediatePropagation() event.preventDefault() true -- cgit v1.2.3