From a3951f1cce978699d81f312c590d71f6ca4c6771 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 26 Jun 2019 21:08:54 +0200 Subject: [PATCH] make sure autocomplete is closed when navigating to note --- src/public/javascripts/services/note_detail.js | 2 +- src/public/javascripts/services/tab_context.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.js index 4ff2f0b92..1c4de84ce 100644 --- a/src/public/javascripts/services/note_detail.js +++ b/src/public/javascripts/services/note_detail.js @@ -405,7 +405,7 @@ tabRow.addListener('tabRemove', async ({ detail }) => { if (tabContextToDelete) { // sometimes there are orphan autocompletes after closing the tab - tabContextToDelete.$tabContent.find('.aa-input').autocomplete('close'); + tabContextToDelete.closeAutocomplete(); await tabContextToDelete.saveNoteIfChanged(); tabContextToDelete.$tabContent.remove(); diff --git a/src/public/javascripts/services/tab_context.js b/src/public/javascripts/services/tab_context.js index 405005c08..65c081525 100644 --- a/src/public/javascripts/services/tab_context.js +++ b/src/public/javascripts/services/tab_context.js @@ -109,6 +109,8 @@ class TabContext { this.setTitleBar(); + this.closeAutocomplete(); // esp. on windows autocomplete is not getting closed automatically + setTimeout(async () => { // we include the note into recent list only if the user stayed on the note at least 5 seconds if (notePath && notePath === this.notePath) { @@ -334,6 +336,10 @@ class TabContext { } } } + + closeAutocomplete() { + this.$tabContent.find('.aa-input').autocomplete('close'); + } } export default TabContext; \ No newline at end of file