Skip to content

Commit

Permalink
Make escape key work in Safari for search
Browse files Browse the repository at this point in the history
  • Loading branch information
Sashko Stubailo committed Dec 5, 2014
1 parent 0cdc382 commit ea54ca9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/client/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ Session.setDefault("searchOpen", false);
Session.set("searchQuery", "");

$(document).on("keydown", function (event) {
console.log(event);
if (event.which === 27) {
Session.set("searchOpen", false);
}
});

var doNotOpenSearch = [13, 27, 32];
$(document).on("keypress", function (event) {
if (event.which && (event.which !== 13) && (event.which !== 32)) {
if (event.which && (! _.contains(doNotOpenSearch, event.which))) {
if (! Session.get("searchOpen")) {
Session.set("searchOpen", true);

Expand Down

0 comments on commit ea54ca9

Please sign in to comment.