« get me outta code hell

client: always capture up/down in search input - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static/js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-01-10 17:40:54 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-01-10 18:51:26 -0400
commit54143b573079250b441834df980a6e04a22e5517 (patch)
treebf8ca2a048683fc45ab612ae8e4d55435749bf4d /src/static/js
parent135811201a999ec21d60a2380ddd870311679704 (diff)
client: always capture up/down in search input
Diffstat (limited to 'src/static/js')
-rw-r--r--src/static/js/client/sidebar-search.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/static/js/client/sidebar-search.js b/src/static/js/client/sidebar-search.js
index 2d346b41..5c1b54b8 100644
--- a/src/static/js/client/sidebar-search.js
+++ b/src/static/js/client/sidebar-search.js
@@ -347,10 +347,13 @@ export function addPageListeners() {
   info.searchInput.addEventListener('drop', handleDroppedIntoSearchInput);
 
   info.searchInput.addEventListener('keydown', domEvent => {
+    if (domEvent.key === 'ArrowUp' || domEvent.key === 'ArrowDown') {
+      domEvent.preventDefault();
+    }
+
     if (domEvent.key === 'ArrowDown') {
       const elem = info.results.firstChild;
       if (elem?.classList.contains('wiki-search-result')) {
-        domEvent.preventDefault();
         elem.focus({focusVisible: true});
       }
     }