diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index 2c6f62060b2..18f8ce3385f 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -84,37 +84,44 @@ r##"
-
-
Keyboard Shortcuts
-
- - ?
- - Show this help dialog
- - S
- - Focus the search field
- - ⇤
- - Move up in search results
- - ⇥
- - Move down in search results
- - ⏎
- - Go to active search result
-
-
-
-
Search Tricks
-
- Prefix searches with a type followed by a colon (e.g.
- fn:
) to restrict the search to a given type.
-
-
- Accepted types are: fn
, mod
,
- struct
, enum
,
- trait
, typedef
(or
- tdef
).
-
-
- Search functions by type signature (e.g.
- vec -> usize
)
-
+
+
+
Keyboard Shortcuts
+
+
+ - ?
+ - Show this help dialog
+ - S
+ - Focus the search field
+ - ⇤
+ - Move up in search results
+ - ⇥
+ - Move down in search results
+ - ⏎
+ - Go to active search result
+
+
+
+
+
Search Tricks
+
+
+ Prefix searches with a type followed by a colon (e.g.
+ fn:
) to restrict the search to a given type.
+
+
+
+ Accepted types are: fn
, mod
,
+ struct
, enum
,
+ trait
, typedef
(or
+ tdef
).
+
+
+
+ Search functions by type signature (e.g.
+ vec -> usize
)
+
+
diff --git a/src/librustdoc/html/static/main.css b/src/librustdoc/html/static/main.css
index 2ecd5589386..774d413fffa 100644
--- a/src/librustdoc/html/static/main.css
+++ b/src/librustdoc/html/static/main.css
@@ -165,7 +165,7 @@ nav.sub {
/* Everything else */
-.js-only, .hidden { display: none; }
+.js-only, .hidden { display: none !important; }
.sidebar {
padding: 10px;
@@ -448,19 +448,30 @@ a {
tr.result span.primitive::after { content: ' (primitive type)'; font-style: italic; }
+body.blur > :not(#help) {
+ filter: blur(8px);
+ -webkit-filter: blur(8px);
+ opacity: .7;
+}
+
#help {
+ width: 100%;
+ height: 100vh;
+ position: fixed;
+ top: 0;
+ left: 0;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+#help > div {
+ flex: 0 0 auto;
background: #e9e9e9;
box-shadow: 0 0 6px rgba(0,0,0,.2);
- position: absolute;
- top: 300px;
- left: 50%;
- margin-top: -125px;
- margin-left: -275px;
width: 550px;
height: 300px;
border: 1px solid #bfbfbf;
}
-
#help dt {
float: left;
border-radius: 4px;
@@ -475,7 +486,7 @@ tr.result span.primitive::after { content: ' (primitive type)'; font-style: ital
#help dd { margin: 5px 33px; }
#help .infos { padding-left: 0; }
#help h1 { margin-top: 0; }
-#help div {
+#help > div div {
width: 50%;
float: left;
padding: 20px;
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index b3ad4774091..1d2cc38b4fc 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -105,6 +105,7 @@
if (!$("#help").hasClass("hidden")) {
ev.preventDefault();
$("#help").addClass("hidden");
+ $("body").removeClass("blur");
} else if (!$("#search").hasClass("hidden")) {
ev.preventDefault();
$("#search").addClass("hidden");
@@ -115,13 +116,14 @@
case "s":
case "S":
ev.preventDefault();
- focusSearchBar()
+ focusSearchBar();
break;
case "?":
if (ev.shiftKey && $("#help").hasClass("hidden")) {
ev.preventDefault();
$("#help").removeClass("hidden");
+ $("body").addClass("blur");
}
break;
}
@@ -130,8 +132,9 @@
$(document).on("keypress", handleShortcut);
$(document).on("keydown", handleShortcut);
$(document).on("click", function(ev) {
- if (!$(ev.target).closest("#help").length) {
+ if (!$(e.target).closest("#help > div").length) {
$("#help").addClass("hidden");
+ $("body").removeClass("blur");
}
});