bkyk8rc3zvpnsf5inmcqq4n3k98cv6hj-my-site-hyper-literate-git.test.suzanne.soy-0.0.1

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 7635f21788b978beb1614e993968278003e73afb
parent 441e97ec274a3c815e940344cc095fcdbb11743d
Author: Ben Greenman <benjaminlgreenman@gmail.com>
Date:   Wed,  1 May 2019 23:35:18 -0400

search box: change '"s" for search' behavior (#202)

1. Focus on the search box for either "s" or "S"
   ... accepting only "s" makes sense to me, but the comment said it
   accepted "S" and well why not
2. Look for a "keyup" event instead of key press, so that pressing "s"
   ONLY focuses on the box and does not focus-and-write-the-letter-"s"

"keyup" events apparently don't have a useful `charCode` field so this
PR looks at the `keyCode` field instead
Diffstat:
Mscribble-lib/scribble/scribble-common.js | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scribble-lib/scribble/scribble-common.js b/scribble-lib/scribble/scribble-common.js @@ -169,10 +169,10 @@ AddOnLoad(function(){ indicator.style.display = "block"; }); -// Pressing "S" focuses on the "...search manuals..." text field +// Pressing "S" or "s" focuses on the "...search manuals..." text field AddOnLoad(function(){ - window.addEventListener("keypress", function(event) { - if (event && event.charCode == 115 && event.target == document.body) { + window.addEventListener("keyup", function(event) { + if (event && (event.keyCode == 83 || event.keyCode == 115) && event.target == document.body) { var field = document.getElementsByClassName("searchbox")[0]; field.focus(); }