Skip to content

Commit 09a1e58

Browse files
committed
Rollup merge of rust-lang#29609 - ivan:rustdoc-ctrl-s, r=steveklabnik
Rustdoc pages with a search box inadvertently override `ctrl-s` in addition to the intended `s` and `S` keys. You can test this in at least Firefox and Chrome (tested: Windows): press `ctrl-s` on http://doc.rust-lang.org/std/. The search box is focused when instead the browser's save feature should be activated. This PR fixes `ctrl-s` and possibly other browser shortcuts.
2 parents 3a0409d + 3b2a8e1 commit 09a1e58

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/librustdoc/html/static/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@
101101
if (document.activeElement.tagName == "INPUT")
102102
return;
103103

104+
// Don't interfere with browser shortcuts
105+
if (ev.ctrlKey || ev.altKey || ev.metaKey)
106+
return;
107+
104108
switch (getVirtualKey(ev)) {
105109
case "Escape":
106110
if (!$("#help").hasClass("hidden")) {

0 commit comments

Comments
 (0)