about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2015-11-05 22:28:48 +0100
committerSteve Klabnik <steve@steveklabnik.com>2015-11-05 22:28:48 +0100
commit09a1e5853eeb82dde8958806e395534ea2854b55 (patch)
tree07460576c33be0fce58ce05da489270d0671096e
parent3a0409d29129d7128a55c93239d81a00d121a200 (diff)
parent3b2a8e125998f3cb7b32ec9268b3b2c6404943fe (diff)
downloadrust-09a1e5853eeb82dde8958806e395534ea2854b55.tar.gz
rust-09a1e5853eeb82dde8958806e395534ea2854b55.zip
Rollup merge of #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.
-rw-r--r--src/librustdoc/html/static/main.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 5a6d7616832..8844ed82bb5 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -101,6 +101,10 @@
         if (document.activeElement.tagName == "INPUT")
             return;
 
+        // Don't interfere with browser shortcuts
+        if (ev.ctrlKey || ev.altKey || ev.metaKey)
+            return;
+
         switch (getVirtualKey(ev)) {
         case "Escape":
             if (!$("#help").hasClass("hidden")) {