]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/webapps/help/search.js
help.html: add null check
[factor.git] / extra / webapps / help / search.js
index db99569fc4e834bd9bccfa455f364855936f3ec2..7ad98c8160029921fa82409d1b6e4c244e50e408 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().select()
+                }, 0);
+            }
         }
     }
 });