diff options
| author | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2021-12-17 22:38:18 -0800 |
|---|---|---|
| committer | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2022-01-05 10:07:22 -0500 |
| commit | 6409f0d5584800f88c12b0e56f56f09626f5b3f0 (patch) | |
| tree | da6b5533ade2c46032c24eeb0f433fce898d6097 | |
| parent | 34dc0d0f249a33fda18755991b4e73ad786d2b19 (diff) | |
| download | rust-6409f0d5584800f88c12b0e56f56f09626f5b3f0.tar.gz rust-6409f0d5584800f88c12b0e56f56f09626f5b3f0.zip | |
Make Run button visible on hover
This slightly reduces the noisiness of doc pages, making them easier to read.
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 5 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/run-on-hover.goml | 7 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/src/test_docs/lib.rs | 1 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index cbb078f2ab3..84f5ef83464 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1117,6 +1117,7 @@ pre.rust .question-mark { a.test-arrow { display: inline-block; + visibility: hidden; position: absolute; padding: 5px 10px 5px 10px; border-radius: 5px; @@ -1125,10 +1126,12 @@ a.test-arrow { right: 5px; z-index: 1; } +.example-wrap:hover .test-arrow { + visibility: visible; +} a.test-arrow:hover{ text-decoration: none; } - .section-header:hover a:before { position: absolute; left: -25px; diff --git a/src/test/rustdoc-gui/run-on-hover.goml b/src/test/rustdoc-gui/run-on-hover.goml new file mode 100644 index 00000000000..b8efa8e302f --- /dev/null +++ b/src/test/rustdoc-gui/run-on-hover.goml @@ -0,0 +1,7 @@ +// Example code blocks sometimes have a "Run" button to run them on the +// Playground. That button is hidden until the user hovers over the code block. +// This test checks that it is hidden, and that it shows on hover. +goto: file://|DOC_PATH|/test_docs/fn.foo.html +assert-css: (".test-arrow", {"visibility": "hidden"}) +move-cursor-to: ".example-wrap" +assert-css: (".test-arrow", {"visibility": "visible"}) diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index 9b37703dded..f75de949292 100644 --- a/src/test/rustdoc-gui/src/test_docs/lib.rs +++ b/src/test/rustdoc-gui/src/test_docs/lib.rs @@ -1,5 +1,6 @@ //! The point of this crate is to be able to have enough different "kinds" of //! documentation generated so we can test each different features. +#![doc(html_playground_url="https://play.rust-lang.org/")] #![crate_name = "test_docs"] #![feature(rustdoc_internals)] |
