]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/webapps/help/search.js
help.html: prevent firefox quick find using '/' key
[factor.git] / extra / webapps / help / search.js
index 674a7bcc9abd4fd0dc28cfd073d5a063213a5c96..db99569fc4e834bd9bccfa455f364855936f3ec2 100644 (file)
@@ -4,3 +4,15 @@ 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) {
+            event.preventDefault();
+            setTimeout(function() {
+                input.focus().select()
+            }, 0);
+        }
+    }
+});