Skip to content

Commit 6409f0d

Browse files
committed
Make Run button visible on hover
This slightly reduces the noisiness of doc pages, making them easier to read.
1 parent 34dc0d0 commit 6409f0d

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/librustdoc/html/static/css/rustdoc.css

+4-1
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,7 @@ pre.rust .question-mark {
11171117

11181118
a.test-arrow {
11191119
display: inline-block;
1120+
visibility: hidden;
11201121
position: absolute;
11211122
padding: 5px 10px 5px 10px;
11221123
border-radius: 5px;
@@ -1125,10 +1126,12 @@ a.test-arrow {
11251126
right: 5px;
11261127
z-index: 1;
11271128
}
1129+
.example-wrap:hover .test-arrow {
1130+
visibility: visible;
1131+
}
11281132
a.test-arrow:hover{
11291133
text-decoration: none;
11301134
}
1131-
11321135
.section-header:hover a:before {
11331136
position: absolute;
11341137
left: -25px;
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Example code blocks sometimes have a "Run" button to run them on the
2+
// Playground. That button is hidden until the user hovers over the code block.
3+
// This test checks that it is hidden, and that it shows on hover.
4+
goto: file://|DOC_PATH|/test_docs/fn.foo.html
5+
assert-css: (".test-arrow", {"visibility": "hidden"})
6+
move-cursor-to: ".example-wrap"
7+
assert-css: (".test-arrow", {"visibility": "visible"})

src/test/rustdoc-gui/src/test_docs/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! The point of this crate is to be able to have enough different "kinds" of
22
//! documentation generated so we can test each different features.
3+
#![doc(html_playground_url="https://play.rust-lang.org/")]
34

45
#![crate_name = "test_docs"]
56
#![feature(rustdoc_internals)]

0 commit comments

Comments
 (0)