summaryrefslogtreecommitdiff
path: root/sphinx/themes/basic/static
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2022-03-20 01:49:48 +0900
committerGitHub <noreply@github.com>2022-03-20 01:49:48 +0900
commit2beeaf746fab1634e47f01c215c9ff69d35833ee (patch)
tree8ce5fb90ee28e2f1a103cb33c2650b646bf65fa3 /sphinx/themes/basic/static
parent109dbb682015bf0d022569f4290eeea31d4b6b56 (diff)
parentaa1bc83c2ac9357b39048b555c3fdb0efff3449c (diff)
downloadsphinx-git-2beeaf746fab1634e47f01c215c9ff69d35833ee.tar.gz
Merge branch 'master' into fix-searchtools
Diffstat (limited to 'sphinx/themes/basic/static')
-rw-r--r--sphinx/themes/basic/static/doctools.js18
1 files changed, 8 insertions, 10 deletions
diff --git a/sphinx/themes/basic/static/doctools.js b/sphinx/themes/basic/static/doctools.js
index f41c76a93..9b5a831b6 100644
--- a/sphinx/themes/basic/static/doctools.js
+++ b/sphinx/themes/basic/static/doctools.js
@@ -168,7 +168,8 @@ const Documentation = {
document
.querySelectorAll("span.highlighted")
.forEach((el) => el.classList.remove("highlighted"));
- new URLSearchParams(window.location.search).delete('highlight')
+ const url = new URL(window.location);
+ url.searchParams.delete('highlight');
window.history.replaceState({}, '', url);
},
@@ -176,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();
},
/**
@@ -232,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();
}
}
@@ -259,7 +257,7 @@ const Documentation = {
if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS)
break;
Documentation.focusSearchBar();
- return false;
+ event.preventDefault();
}
});
},