]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/webapps/help/search.js
help.html: implement "/" for making search box active.
[factor.git] / extra / webapps / help / search.js
index 674a7bcc9abd4fd0dc28cfd073d5a063213a5c96..b48c5771bb27507009c4c25c6ba39b4e712912bb 100644 (file)
@@ -4,3 +4,14 @@ window.onload = function() {
         radios[0].checked = true;
     }
 }
+
+document.addEventListener('keydown', function (event) {
+    if (event.code == 'Slash') {
+        let input = document.getElementById('search');
+        if (input !== document.activeElement) {
+            setTimeout(function() {
+                input.focus().select()
+            }, 0);
+        }
+    }
+});