From 2bfd3ea1250a643659b9ae6d9a04816ebbc78fb7 Mon Sep 17 00:00:00 2001 From: HighImKevin Date: Sat, 14 Mar 2026 15:44:35 -0400 Subject: [PATCH] Update logic for hiding auto complete results --- scripts/ui.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/ui.js b/scripts/ui.js index e1312e3..af6be01 100644 --- a/scripts/ui.js +++ b/scripts/ui.js @@ -669,11 +669,9 @@ }); } - // Hide suggestions when clicking outside - document.addEventListener('click', (e) => { - if (!badgeContainer.contains(e.target) && !suggestionsDiv.contains(e.target)) { - suggestionsDiv.style.display = 'none'; - } + // Hide suggestions when focus leaves the input + input.addEventListener('blur', () => { + suggestionsDiv.style.display = 'none'; }); // Setup chevron button (triggers dropdown like down arrow) @@ -689,6 +687,7 @@ // Dropdown is closed, open it if (input.value.trim().length === 0) { showAllSuggestions(); + input.focus(); } else { // Trigger input event to show filtered suggestions input.dispatchEvent(new Event('input', { bubbles: true }));