Browse Source

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
Richard Nespithal 7 years ago
parent
commit
0314349b08
1 changed files with 2 additions and 1 deletions
  1. 2 1
      searx/static/plugins/js/vim_hotkeys.js

+ 2 - 1
searx/static/plugins/js/vim_hotkeys.js

@@ -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
         if (vimKeys.hasOwnProperty(e.keyCode)
             && !e.ctrlKey
@@ -118,6 +118,7 @@ $(document).ready(function() {
                 }
             } else {
                 if (e.target === document.body) {
+                    e.preventDefault();
                     vimKeys[e.keyCode].fun();
                 }
             }