diff options
| author | Phil Crosby | 2010-01-03 00:35:59 -0500 |
|---|---|---|
| committer | Phil Crosby | 2010-01-03 00:36:19 -0500 |
| commit | 06e147224610d6456030a00e305661a2c8f5db45 (patch) | |
| tree | 693eaa98bae278d21be6c00f4a2e0599506d25d0 | |
| parent | 4c788dff756d0e4623b91fd2538a722d00f861fe (diff) | |
| download | vimium-06e147224610d6456030a00e305661a2c8f5db45.tar.bz2 | |
Listen for vimium keydown events in the capture phase, so they are never sent to the webpage. Fixes #41.
| -rw-r--r-- | vimiumFrontend.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vimiumFrontend.js b/vimiumFrontend.js index 9f64f1c6..06650feb 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -132,7 +132,7 @@ function initializePreDomReady() { * This is called once the background page has told us that Vimium should be enabled for the current URL. */ function initializeWhenEnabled() { - document.addEventListener("keydown", onKeydown); + document.addEventListener("keydown", onKeydown, true); document.addEventListener("focus", onFocusCapturePhase, true); document.addEventListener("blur", onBlurCapturePhase, true); enterInsertModeIfElementIsFocused(); @@ -291,8 +291,10 @@ function onKeydown(event) { } else if (!insertMode && !findMode && keyChar) { - if (currentCompletionKeys.indexOf(keyChar) != -1) + if (currentCompletionKeys.indexOf(keyChar) != -1) { event.preventDefault(); + event.stopPropagation(); + } keyPort.postMessage(keyChar); } |
