From 4d56f145bec2aadbff748ab5a04a70dbb6af8f4e Mon Sep 17 00:00:00 2001 From: Severyn Kozak Date: Fri, 6 Jun 2014 18:03:16 -0400 Subject: [PATCH] Suppress hotkeys entered in text inputs. Fix #58. Add: static/js/index.js -Suppress hotkey (`h`, `j` `k`, and `l`) events when the keys are entered in text input-fields. --- static/js/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index 5dedf75..f73a640 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -11,6 +11,7 @@ var resultsDiv = $("div#results")[0]; var typingTimer, scrollTimer, lastValue; var searchResultsPage = 1; + /* * Set all page callbacks. */ @@ -115,9 +116,9 @@ var searchResultsPage = 1; $(window).keypress(function(key){ for(var hotkey in hotkeyActions){ var keyChar = String.fromCharCode(key.keyCode); - if(keyChar == hotkey) { + if(keyChar == hotkey && + !($(key.target).is("textarea") || $(key.target).is("input"))) hotkeyActions[keyChar](); - } } }); }());