]> 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 db99569fc4e834bd9bccfa455f364855936f3ec2..8a39d8e824ebb7e71a7320131e9738ee585bf7a5 100644 (file)
@@ -8,11 +8,13 @@ window.onload = function() {
 document.addEventListener('keydown', function (event) {
     if (event.code == 'Slash') {
         let input = document.getElementById('search');
-        if (input !== document.activeElement) {
-            event.preventDefault();
-            setTimeout(function() {
-                input.focus().select()
-            }, 0);
+        if (input != null) {
+            if (input !== document.activeElement) {
+                event.preventDefault();
+                setTimeout(function() {
+                    input.focus();
+                }, 0);
+            }
         }
     }
 });