aboutsummaryrefslogtreecommitdiff
path: root/docs/sphinx-static
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2021-10-09 01:47:56 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2021-11-08 12:27:23 +0400
commit9423751645d27ae1146ca645431c368f09cb3b6c (patch)
tree3f1f5263f576b95b51db2564759e6d80929093bf /docs/sphinx-static
parent96871b38547211d8d91e7d059a3322e67b53657c (diff)
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.js9
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();
+ }
+});