Sfoglia il codice sorgente

Prevent default for up and down keys

Daoud Clarke 3 anni fa
parent
commit
f754b38f71
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 2 0
      static/index.js

+ 2 - 0
static/index.js

@@ -36,8 +36,10 @@ window.onload = (event) => {
         console.log("Key press", e);
         console.log("Key press", e);
         if (e.key == 'ArrowDown') {
         if (e.key == 'ArrowDown') {
             selectNextItem();
             selectNextItem();
+            e.preventDefault();
         } else if (e.key == 'ArrowUp') {
         } else if (e.key == 'ArrowUp') {
             selectPreviousItem();
             selectPreviousItem();
+            e.preventDefault();
         } else if (e.key == 'Enter') {
         } else if (e.key == 'Enter') {
 //            const form = document.getElementById('search-form');
 //            const form = document.getElementById('search-form');
 //            form.submit();
 //            form.submit();