Browse Source

Fix keypress focus (#478)

Timothy Palpant 5 years ago
parent
commit
34ac40c74b
1 changed files with 8 additions and 5 deletions
  1. 8
    5
      internal/driver/webhtml.go

+ 8
- 5
internal/driver/webhtml.go View File

610
 
610
 
611
   function handleKey(e) {
611
   function handleKey(e) {
612
     if (e.keyCode != 13) return;
612
     if (e.keyCode != 13) return;
613
-    window.location.href =
614
-        updateUrl(new URL(window.location.href), 'f');
613
+    setHrefParams(window.location, function (params) {
614
+      params.set('f', search.value);
615
+    });
615
     e.preventDefault();
616
     e.preventDefault();
616
   }
617
   }
617
 
618
 
650
     })
651
     })
651
 
652
 
652
     // add matching items that are not currently selected.
653
     // add matching items that are not currently selected.
653
-    for (let n = 0; n < nodes.length; n++) {
654
-      if (!selected.has(n) && match(nodes[n])) {
655
-        select(n, document.getElementById('node' + n));
654
+    if (nodes) {
655
+      for (let n = 0; n < nodes.length; n++) {
656
+        if (!selected.has(n) && match(nodes[n])) {
657
+          select(n, document.getElementById('node' + n));
658
+        }
656
       }
659
       }
657
     }
660
     }
658
 
661