Skip to content

Commit 8774484

Browse files
Add option to disable keyboard shortcuts in docs
1 parent 14f0ed6 commit 8774484

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/librustdoc/html/render.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,7 @@ fn settings(root_path: &str, suffix: &str) -> String {
12411241
("go-to-only-result", "Directly go to item in search if there is only one result",
12421242
false),
12431243
("line-numbers", "Show line numbers on code examples", false),
1244+
("disable-shortcuts", "Disable keyboard shortcuts", false),
12441245
];
12451246
format!(
12461247
"<h1 class='fqn'>\

src/librustdoc/html/static/main.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ function getSearchElement() {
7979
"derive",
8080
"traitalias"];
8181

82+
var disableShortcuts = getCurrentValue("rustdoc-disable-shortcuts") !== "true";
8283
var search_input = getSearchInput();
8384

8485
// On the search screen, so you remain on the last tab you opened.
@@ -294,7 +295,7 @@ function getSearchElement() {
294295

295296
function handleShortcut(ev) {
296297
// Don't interfere with browser shortcuts
297-
if (ev.ctrlKey || ev.altKey || ev.metaKey) {
298+
if (ev.ctrlKey || ev.altKey || ev.metaKey || disableShortcuts === true) {
298299
return;
299300
}
300301

0 commit comments

Comments
 (0)