« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static
diff options
context:
space:
mode:
Diffstat (limited to 'src/static')
-rw-r--r--src/static/js/client/sidebar-search.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/static/js/client/sidebar-search.js b/src/static/js/client/sidebar-search.js
index 2e34baad..10ccf1b5 100644
--- a/src/static/js/client/sidebar-search.js
+++ b/src/static/js/client/sidebar-search.js
@@ -106,7 +106,7 @@ export const info = {
     stoppedTypingDelay: 800,
     stoppedScrollingDelay: 200,
 
-    pressDownToFocusFirstResultLatency: 200,
+    pressDownToFocusFirstResultLatency: 500,
     dismissChangeEventAfterFocusingFirstResultLatency: 50,
 
     maxActiveResultsStorage: 100000,
@@ -339,6 +339,11 @@ export function addPageListeners() {
         state.stoppedTypingTimeout = null;
         activateSidebarSearch(info.searchInput.value);
       }, settings.stoppedTypingDelay);
+
+    if (state.focusFirstResultTimeout) {
+      clearTimeout(state.focusFirstResultTimeout);
+      state.focusFirstResultTimeout = null;
+    }
   });
 
   info.searchInput.addEventListener('drop', handleDroppedIntoSearchInput);
@@ -495,9 +500,7 @@ async function activateSidebarSearch(query) {
   if (state.focusFirstResultTimeout) {
     clearTimeout(state.focusFirstResultTimeout);
     state.focusFirstResultTimeout = null;
-    if (!state.stoppedTypingTimeout) {
-      focusFirstSidebarSearchResult();
-    }
+    focusFirstSidebarSearchResult();
   }
 }