浏览代码

fix(search): disable shortcuts when user is typing

Fix #875
George Cushen 6 年之前
父节点
当前提交
512e2ffde4
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      assets/js/academic.js

+ 3 - 1
assets/js/academic.js

@@ -431,10 +431,12 @@
     });
     $(document).on('keydown', function(e){
       if (e.which == 27) {
+        // `Esc` key pressed.
         if ($('body').hasClass('searching')) {
           toggleSearchDialog();
         }
-      } else if (e.which == 191) {
+      } else if (e.which == 191 && e.shiftKey == false && !$('input,textarea').is(':focus')) {
+        // `/` key pressed outside of text input.
         e.preventDefault();
         toggleSearchDialog();
       }