]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/webapps/help/search.js
help.html: only input.focus().
[factor.git] / extra / webapps / help / search.js
index b48c5771bb27507009c4c25c6ba39b4e712912bb..8a39d8e824ebb7e71a7320131e9738ee585bf7a5 100644 (file)
@@ -8,10 +8,13 @@ window.onload = function() {
 document.addEventListener('keydown', function (event) {
     if (event.code == 'Slash') {
         let input = document.getElementById('search');
-        if (input !== document.activeElement) {
-            setTimeout(function() {
-                input.focus().select()
-            }, 0);
+        if (input != null) {
+            if (input !== document.activeElement) {
+                event.preventDefault();
+                setTimeout(function() {
+                    input.focus();
+                }, 0);
+            }
         }
     }
 });