From 9051e6d882b341a29dc37eb95fcf237ab0b9161e Mon Sep 17 00:00:00 2001 From: Milo Turner Date: Tue, 29 Aug 2017 13:59:24 -0400 Subject: [PATCH] pressing "S" on the page body focuses to the search box --- scribble-lib/scribble/scribble-common.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scribble-lib/scribble/scribble-common.js b/scribble-lib/scribble/scribble-common.js index 1ec7da58..976298e6 100644 --- a/scribble-lib/scribble/scribble-common.js +++ b/scribble-lib/scribble/scribble-common.js @@ -168,3 +168,13 @@ AddOnLoad(function(){ indicator.innerHTML = label; indicator.style.display = "block"; }); + +// Pressing "S" focuses on the "...search manuals..." text field +AddOnLoad(function(){ + window.addEventListener("keypress", function(event) { + if (event && event.charCode == 115 && event.target == document.body) { + var field = document.getElementsByClassName("searchbox")[0]; + field.focus(); + } + }, false); +});