diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-12-16 14:02:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-16 14:02:19 +0100 |
| commit | 0820bb2826364ef96425463dfca66abd66b1573c (patch) | |
| tree | d7c93875a6ad9a7d4404e0c14e19ff4297b84664 | |
| parent | 1ad070a11870297c05ca3eadbbf7c61b11d436bd (diff) | |
| parent | f28a8ca1dce6b8e8ce7d89bdb2030d74d06039c4 (diff) | |
| download | rust-0820bb2826364ef96425463dfca66abd66b1573c.tar.gz rust-0820bb2826364ef96425463dfca66abd66b1573c.zip | |
Rollup merge of #105756 - notriddle:notriddle/example-wrap-tooltip, r=GuillaumeGomez
rustdoc: simplify CSS for codeblock tooltips Instead of making its parts `display: none` and then changing it on hover, just make the pseudo-element itself on hover.
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 18 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/codeblock-tooltip.goml | 6 |
2 files changed, 9 insertions, 15 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index a527e9feaec..c48481d4dae 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1118,8 +1118,7 @@ pre.rust .doccomment { top: 5px; } -.example-wrap .tooltip::after { - display: none; +.example-wrap .tooltip:hover::after { text-align: center; padding: 5px 3px 3px 3px; border-radius: 6px; @@ -1134,35 +1133,30 @@ pre.rust .doccomment { color: var(--tooltip-color); } -.example-wrap .tooltip::before { +.example-wrap .tooltip:hover::before { content: " "; position: absolute; top: 50%; left: 16px; margin-top: -5px; - display: none; z-index: 1; border: 5px solid transparent; border-right-color: var(--tooltip-background-color); } -.example-wrap.ignore .tooltip::after { +.example-wrap.ignore .tooltip:hover::after { content: "This example is not tested"; } -.example-wrap.compile_fail .tooltip::after { +.example-wrap.compile_fail .tooltip:hover::after { content: "This example deliberately fails to compile"; } -.example-wrap.should_panic .tooltip::after { +.example-wrap.should_panic .tooltip:hover::after { content: "This example panics"; } -.example-wrap.edition .tooltip::after { +.example-wrap.edition .tooltip:hover::after { content: "This code runs with edition " attr(data-edition); } -.example-wrap .tooltip:hover::before, .example-wrap .tooltip:hover::after { - display: inline; -} - .example-wrap.compile_fail .tooltip, .example-wrap.should_panic .tooltip, .example-wrap.ignore .tooltip { diff --git a/src/test/rustdoc-gui/codeblock-tooltip.goml b/src/test/rustdoc-gui/codeblock-tooltip.goml index 4d923be3e78..aab27394eb1 100644 --- a/src/test/rustdoc-gui/codeblock-tooltip.goml +++ b/src/test/rustdoc-gui/codeblock-tooltip.goml @@ -20,7 +20,7 @@ define-function: ( {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}, )), - ("move-cursor-to", ".docblock .example-wrap.compile_fail"), + ("move-cursor-to", ".docblock .example-wrap.compile_fail .tooltip"), ("assert-css", ( ".docblock .example-wrap.compile_fail .tooltip", @@ -60,7 +60,7 @@ define-function: ( {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}, )), - ("move-cursor-to", ".docblock .example-wrap.should_panic"), + ("move-cursor-to", ".docblock .example-wrap.should_panic .tooltip"), ("assert-css", ( ".docblock .example-wrap.should_panic .tooltip", @@ -100,7 +100,7 @@ define-function: ( {"border-left": "2px solid rgba(255, 142, 0, 0.6)"}, )), - ("move-cursor-to", ".docblock .example-wrap.ignore"), + ("move-cursor-to", ".docblock .example-wrap.ignore .tooltip"), ("assert-css", ( ".docblock .example-wrap.ignore .tooltip", |
