From 438f7c5b0bdbfaf5ef5381a80e01c929cf3c3365 Mon Sep 17 00:00:00 2001 From: azivner Date: Sun, 11 Feb 2018 11:53:43 -0500 Subject: [PATCH] escape should close the recent notes dialog --- src/public/javascripts/dialogs/recent_notes.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/public/javascripts/dialogs/recent_notes.js b/src/public/javascripts/dialogs/recent_notes.js index b48c08266..ae63b21e4 100644 --- a/src/public/javascripts/dialogs/recent_notes.js +++ b/src/public/javascripts/dialogs/recent_notes.js @@ -59,9 +59,15 @@ const recentNotes = (function() { event.preventDefault(); }, close: function (event, ui) { - // keep autocomplete open - // we're kind of abusing autocomplete to work in a way which it's not designed for - $searchInput.autocomplete("search", "") + if (event.keyCode === 27) { // escape closes dialog + $searchInput.autocomplete('destroy'); + $dialog.dialog('close'); + } + else { + // keep autocomplete open + // we're kind of abusing autocomplete to work in a way which it's not designed for + $searchInput.autocomplete("search", ""); + } }, create: () => $searchInput.autocomplete("search", ""), classes: {