philc/vimium — pull request #1219 by mrmr1993 (2014-11-02 05:46:18+00:00)
Title: 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)).

This fixes #1218.