From 1d4ab8fff13fe16733471247ae6d34ad541f8493 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Tue, 31 Jul 2018 17:39:03 +0300 Subject: [PATCH] Fix autocompletion menu not closing on send --- client/js/autocompletion.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/client/js/autocompletion.js b/client/js/autocompletion.js index ab86c70a..89b159ac 100644 --- a/client/js/autocompletion.js +++ b/client/js/autocompletion.js @@ -16,6 +16,7 @@ module.exports = { enable: enableAutocomplete, disable() { if (enabled) { + $("#form").off("submit.tabcomplete"); input.off("input.tabcomplete"); Mousetrap(input.get(0)).unbind("tab", "keydown"); textcomplete.destroy(); @@ -24,12 +25,6 @@ module.exports = { }, }; -$("#form").on("submit", () => { - if (enabled) { - textcomplete.hide(); - } -}); - const emojiSearchTerms = Object.keys(emojiMap); const emojiStrategy = { id: "emoji", @@ -263,6 +258,10 @@ function enableAutocomplete(inputRef) { textcomplete.on("hidden", () => { autocompleting = false; }); + + $("#form").on("submit.tabcomplete", () => { + textcomplete.hide(); + }); } function fuzzyGrep(term, array) {