summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sphinx/themes/basic/static/doctools.js15
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();
}
});
},