1
0
mirror of https://github.com/searx/searx synced 2024-12-12 08:46:26 +01:00

Fix Vim mode on Firefox

Firefox automatically opens a built-in quick search when user
starts typing without selected input and the Vim shortcuts
are not triggered
This commit is contained in:
Richard Nespithal 2018-03-05 13:41:37 +01:00
parent 9fea2060b5
commit 0314349b08
No known key found for this signature in database
GPG Key ID: 89C6EE6B7BFDB1AA

View File

@ -104,7 +104,7 @@ $(document).ready(function() {
} }
}; };
$(document).keyup(function(e) { $(document).keydown(function(e) {
// check for modifiers so we don't break browser's hotkeys // check for modifiers so we don't break browser's hotkeys
if (vimKeys.hasOwnProperty(e.keyCode) if (vimKeys.hasOwnProperty(e.keyCode)
&& !e.ctrlKey && !e.ctrlKey
@ -118,6 +118,7 @@ $(document).ready(function() {
} }
} else { } else {
if (e.target === document.body) { if (e.target === document.body) {
e.preventDefault();
vimKeys[e.keyCode].fun(); vimKeys[e.keyCode].fun();
} }
} }