diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-03-14 02:02:26 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-14 02:02:26 +0900 |
commit | 759a526b12213c59d6ae4c8f66682f4328b764f4 (patch) | |
tree | 67af1164dff7cd7108fea8e65fda7c22d515aa91 | |
parent | c5fcd78f6e07109276f31461526c7bd49bf8bcea (diff) | |
parent | a7d6ae05edcca80a98b47a7c61c2a076b9b1c1d3 (diff) | |
download | sphinx-git-759a526b12213c59d6ae4c8f66682f4328b764f4.tar.gz |
Merge pull request #10245 from stsewd/fix-shortcuts
doctools: fix shortcuts
-rw-r--r-- | sphinx/themes/basic/static/doctools.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/sphinx/themes/basic/static/doctools.js b/sphinx/themes/basic/static/doctools.js index 8a62420ac..9b5a831b6 100644 --- a/sphinx/themes/basic/static/doctools.js +++ b/sphinx/themes/basic/static/doctools.js @@ -177,10 +177,7 @@ const Documentation = { * helper function to focus on search bar */ focusSearchBar : () => { - document - .querySelectorAll("input[name=q]") - .first() - .focus() + document.querySelectorAll("input[name=q]")[0]?.focus(); }, /** @@ -233,24 +230,24 @@ const Documentation = { const prevLink = document.querySelector('link[rel="prev"]'); if (prevLink && prevLink.href) { window.location.href = prevLink.href; - return false; + event.preventDefault(); } break; case "ArrowRight": if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; - const nextLink = document.querySelector('link[rel="next"]').href; + const nextLink = document.querySelector('link[rel="next"]'); if (nextLink && nextLink.href) { window.location.href = nextLink.href; - return false; + event.preventDefault(); } break; case "Escape": if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; Documentation.hideSearchWords(); - return false; + event.preventDefault(); } } @@ -260,7 +257,7 @@ const Documentation = { if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; Documentation.focusSearchBar(); - return false; + event.preventDefault(); } }); }, |