Skip to content

Build your personal knowledge base with Trilium Notes

make sure autocomplete is closed when navigating to note

zadama3951f1cce97
diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.js
index 4ff2f0b920..1c4de84ce4 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 405005c087..65c0815254 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