diff options
author | Marc-André Lureau | 2021-10-08 23:47:56 +0200 |
---|---|---|
committer | Marc-André Lureau | 2021-11-08 09:27:23 +0100 |
commit | 9423751645d27ae1146ca645431c368f09cb3b6c (patch) | |
tree | 3f1f5263f576b95b51db2564759e6d80929093bf /docs/sphinx-static | |
parent | docs/sphinx: set navigation_with_keys=True (diff) | |
download | qemu-9423751645d27ae1146ca645431c368f09cb3b6c.tar.gz qemu-9423751645d27ae1146ca645431c368f09cb3b6c.tar.xz qemu-9423751645d27ae1146ca645431c368f09cb3b6c.zip |
docs/sphinx: add 's' keyboard binding to focus search
This is pretty ubiquitous. ('/' is already taken by some browsers for
quick search)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'docs/sphinx-static')
-rw-r--r-- | docs/sphinx-static/custom.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/sphinx-static/custom.js b/docs/sphinx-static/custom.js new file mode 100644 index 0000000000..71a8605305 --- /dev/null +++ b/docs/sphinx-static/custom.js @@ -0,0 +1,9 @@ +document.addEventListener('keydown', (event) => { + // find a better way to look it up? + let search_input = document.getElementsByName('q')[0]; + + if (event.code === 'KeyS' && document.activeElement !== search_input) { + event.preventDefault(); + search_input.focus(); + } +}); |