From b454ad8dadd93c3e04f70a9e60ddb9cf30463c89 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sun, 30 Aug 2020 16:56:16 +0200 Subject: [PATCH] Hide note selector when the user clicks elsewhere --- note_kfet/static/js/base.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/note_kfet/static/js/base.js b/note_kfet/static/js/base.js index 3863dac1..c12e3f0a 100644 --- a/note_kfet/static/js/base.js +++ b/note_kfet/static/js/base.js @@ -213,6 +213,13 @@ function autoCompleteNote (field_id, note_list_id, notes, notes_display, alias_p fallbackPlacement: 'clockwise' }); + // When the user clicks elsewhere, we hide the tooltip + $(document).click(function(e) { + if (!e.target.id.startsWith(alias_prefix)) { + field.tooltip("hide"); + } + }); + let old_pattern = null; // Clear search on click