aboutsummaryrefslogtreecommitdiffstats
path: root/vimiumFrontend.js
diff options
context:
space:
mode:
authorIlya Sukhar2010-10-24 15:47:56 -0700
committerIlya Sukhar2010-10-24 15:47:56 -0700
commit080bffabcf0eb3be789db257c1417ffbfd17277d (patch)
tree5b04c7e97ec0a6c85b40f88f7472907b72a277e6 /vimiumFrontend.js
parent780e1bf58ef09b5b4a7c9a0c3ad0c72a2265b39e (diff)
downloadvimium-080bffabcf0eb3be789db257c1417ffbfd17277d.tar.bz2
Fixed Vimium getting overridden by Google Instant Search.
May be subject to internationalization issues still but it's much better than before.
Diffstat (limited to 'vimiumFrontend.js')
-rw-r--r--vimiumFrontend.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/vimiumFrontend.js b/vimiumFrontend.js
index 8e5b8246..77580a29 100644
--- a/vimiumFrontend.js
+++ b/vimiumFrontend.js
@@ -386,6 +386,10 @@ function onKeydown(event) {
// Remove focus so the user can't just get himself back into insert mode by typing in the same input box.
if (isEditable(event.srcElement)) { event.srcElement.blur(); }
exitInsertMode();
+
+ // Added to prevent Google Instant from reclaiming the keystroke and putting us back into the search box.
+ // TOOD(ilya): Revisit this. Not sure it's the absolute best approach.
+ event.stopPropagation();
}
}
else if (findMode)
@@ -418,6 +422,16 @@ function onKeydown(event) {
keyPort.postMessage({keyChar:"<ESC>", frameId:frameId});
}
}
+
+ // Added to prevent propagating this event to other listeners if it's one that'll trigger a Vimium command.
+ // The goal is to avoid the scenario where Google Instant Search uses every keydown event to dump us
+ // back into the search box. As a side effect, this should also prevent overriding by other sites.
+ //
+ // Subject to internationalization issues since we're using keyIdentifier instead of charCode (in keypress).
+ //
+ // TOOD(ilya): Revisit this. Not sure it's the absolute best approach.
+ if (keyChar == "" && !insertMode && currentCompletionKeys.indexOf(getKeyChar(event)) != -1)
+ event.stopPropagation();
}
function refreshCompletionKeys(completionKeys) {