Skip to content

Commit 7bcd95c

Browse files
committed
Auto merge of rust-lang#119743 - lukas-code:beta-z-index, r=notriddle
[beta] rustdoc ui: adjust tooltip z-index to be above sidebar Backport of rust-lang#119477. Fixes rust-lang#119472. range-diff: ```range-diff 446: d796ad4 = 11: 53637cd rustdoc ui: adjust tooltip z-index to be above sidebar 459: b1853eb ! 12: c4c4ff6 use css variable for z-index of the sidebar `@@` src/librustdoc/html/static/css/rustdoc.css: so that we can apply CSS-filters to margin-top: 7px; border-radius: 3px; border: 1px solid var(--border-color); -`@@` src/librustdoc/html/static/css/rustdoc.css: a.tooltip:hover::after { - } - .src #sidebar-button { - left: 8px; -- z-index: 101; -+ z-index: calc(var(--desktop-sidebar-z-index) + 1); - } - .hide-sidebar .src #sidebar-button { - position: static; ``` The "show sidebar" button on the [source view page](https://doc.rust-lang.org/nightly/src/std/lib.rs.html) works differently on beta and nightly, but it is in fact above the sidebar in both versions. beta button: ![beta button](https://github.com/rust-lang/rust/assets/26522220/24d7e86f-d19e-452f-bef2-6b6004b42255) nightly button: ![nightly button](https://github.com/rust-lang/rust/assets/26522220/239dfdda-d9ca-4945-94dd-96254ed1c13f) cc `@Mark-Simulacrum`
2 parents 3a3478e + c4c4ff6 commit 7bcd95c

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
and on the RUSTDOC_MOBILE_BREAKPOINT */
1515
--desktop-sidebar-width: 200px;
1616
--src-sidebar-width: 300px;
17+
--desktop-sidebar-z-index: 100;
1718
}
1819

1920
/* See FiraSans-LICENSE.txt for the Fira Sans license. */
@@ -396,7 +397,7 @@ img {
396397
height: 100vh;
397398
top: 0;
398399
left: 0;
399-
z-index: 100;
400+
z-index: var(--desktop-sidebar-z-index);
400401
}
401402

402403
.rustdoc.src .sidebar {
@@ -416,7 +417,7 @@ img {
416417
touch-action: none;
417418
width: 9px;
418419
cursor: col-resize;
419-
z-index: 200;
420+
z-index: calc(var(--desktop-sidebar-z-index) + 1);
420421
position: fixed;
421422
height: 100%;
422423
/* make sure there's a 1px gap between the scrollbar and resize handle */
@@ -448,7 +449,6 @@ img {
448449

449450
.sidebar-resizing .sidebar {
450451
position: fixed;
451-
z-index: 100;
452452
}
453453
.sidebar-resizing > body {
454454
padding-left: var(--resizing-sidebar-width);
@@ -1059,7 +1059,7 @@ so that we can apply CSS-filters to change the arrow color in themes */
10591059
position: absolute;
10601060
top: 100%;
10611061
right: 0;
1062-
z-index: 2;
1062+
z-index: calc(var(--desktop-sidebar-z-index) + 1);
10631063
margin-top: 7px;
10641064
border-radius: 3px;
10651065
border: 1px solid var(--border-color);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Check that the doctest info tooltips are above the sidebar.
2+
go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
3+
move-cursor-to: ".example-wrap.ignore .tooltip"
4+
wait-for: ".tooltip.popover"
5+
6+
// Move cursor to top left corner of the tooltip and check that it doesn't fade.
7+
move-cursor-to: ".tooltip.popover"
8+
wait-for: 100
9+
assert: ".tooltip.popover:not(.fade-out)"
10+
11+
move-cursor-to: (0, 0)
12+
wait-for: ".tooltip.popover.fade-out"

0 commit comments

Comments
 (0)