aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Crosby2010-01-03 00:35:59 -0500
committerPhil Crosby2010-01-03 00:36:19 -0500
commit06e147224610d6456030a00e305661a2c8f5db45 (patch)
tree693eaa98bae278d21be6c00f4a2e0599506d25d0
parent4c788dff756d0e4623b91fd2538a722d00f861fe (diff)
downloadvimium-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.js6
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);
}