]> 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 674a7bcc9abd4fd0dc28cfd073d5a063213a5c96..7ad98c8160029921fa82409d1b6e4c244e50e408 100644 (file)
@@ -4,3 +4,17 @@ window.onload = function() {
         radios[0].checked = true;
     }
 }
+
+document.addEventListener('keydown', function (event) {
+    if (event.code == 'Slash') {
+        let input = document.getElementById('search');
+        if (input != null) {
+            if (input !== document.activeElement) {
+                event.preventDefault();
+                setTimeout(function() {
+                    input.focus().select()
+                }, 0);
+            }
+        }
+    }
+});