From ca03d7becf6eff26664d3aab7e43a14f5f6c62c9 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Wed, 11 Sep 2024 18:28:06 -0400 Subject: avoid replacing results after focusing --- src/static/js/client/sidebar-search.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/static/js/client/sidebar-search.js') diff --git a/src/static/js/client/sidebar-search.js b/src/static/js/client/sidebar-search.js index 34d2161f..ae18c930 100644 --- a/src/static/js/client/sidebar-search.js +++ b/src/static/js/client/sidebar-search.js @@ -303,15 +303,20 @@ export function mutatePageContent() { export function addPageListeners() { if (!info.searchInput) return; + let prevValue = null; info.searchInput.addEventListener('change', _domEvent => { - if (info.searchInput.value) { + if (info.searchInput.value && info.searchInput.value !== prevValue) { activateSidebarSearch(info.searchInput.value); } + prevValue = info.searchInput.value; }); info.searchInput.addEventListener('input', _domEvent => { const {settings, state} = info; + if (prevValue === info.searchInput.value) return; + prevValue = info.searchInput.value; + if (!info.searchInput.value) { clearSidebarSearch(); return; -- cgit 1.3.0-6-gf8a5