Skip to content

Commit e36c3c1

Browse files
authored
Rollup merge of #102491 - notriddle:notriddle/sidebar-opacity, r=GuillaumeGomez
rustdoc: remove no-op source sidebar `opacity` These rules were added in dc2c972 to work with CSS transitions. They're otherwise redundant, since the `visibility` property already hides everything. https://github.com/rust-lang/rust/blob/dc2c9723343c985740be09919236a6e96c4e4433/src/librustdoc/html/static/css/rustdoc.css#L350-L354 The transition was remove with 237d625, but the now-redundant `opacity` property was not.
2 parents c4a1876 + db376ee commit e36c3c1

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

Diff for: src/librustdoc/html/static/css/rustdoc.css

-2
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,6 @@ img {
448448
}
449449

450450
.source .sidebar > *:not(#sidebar-toggle) {
451-
opacity: 0;
452451
visibility: hidden;
453452
}
454453

@@ -457,7 +456,6 @@ img {
457456
}
458457

459458
.source-sidebar-expanded .source .sidebar > *:not(#sidebar-toggle) {
460-
opacity: 1;
461459
visibility: visible;
462460
}
463461

Diff for: src/test/rustdoc-gui/sidebar-source-code-display.goml

+8-11
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,17 @@ javascript: false
33
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
44
// Since the javascript is disabled, there shouldn't be a toggle.
55
assert-false: "#sidebar-toggle"
6-
// For some reason, we need to wait a bit here because it seems like the transition on opacity
7-
// is being applied whereas it can't be reproduced in a browser...
8-
wait-for-css: (".sidebar > *", {"visibility": "hidden", "opacity": 0})
6+
wait-for-css: (".sidebar > *", {"visibility": "hidden"})
97

108
// Let's retry with javascript enabled.
119
javascript: true
1210
reload:
1311
wait-for: "#sidebar-toggle"
14-
assert-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
15-
assert-css: (".sidebar > *:not(#sidebar-toggle)", {"visibility": "hidden", "opacity": 0})
12+
assert-css: ("#sidebar-toggle", {"visibility": "visible"})
13+
assert-css: (".sidebar > *:not(#sidebar-toggle)", {"visibility": "hidden"})
1614
// Let's expand the sidebar now.
1715
click: "#sidebar-toggle"
18-
// Because of the transition CSS, we check by using `wait-for-css` instead of `assert-css`.
19-
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
16+
wait-for-css: ("#sidebar-toggle", {"visibility": "visible"})
2017

2118
// We now check that opening the sidebar and clicking a link will leave it open.
2219
// The behavior here on desktop is different than the behavior on mobile,
@@ -36,7 +33,7 @@ show-text: true
3633
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
3734
reload:
3835
// Waiting for the sidebar to be displayed...
39-
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
36+
wait-for-css: ("#sidebar-toggle", {"visibility": "visible"})
4037
assert-css: (
4138
"#source-sidebar details[open] > .files a.selected",
4239
{"color": "rgb(0, 0, 0)", "background-color": "rgb(255, 255, 255)"},
@@ -91,7 +88,7 @@ assert-css: (
9188
local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
9289
reload:
9390
// Waiting for the sidebar to be displayed...
94-
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
91+
wait-for-css: ("#sidebar-toggle", {"visibility": "visible"})
9592
assert-css: (
9693
"#source-sidebar details[open] > .files > a.selected",
9794
{"color": "rgb(221, 221, 221)", "background-color": "rgb(51, 51, 51)"},
@@ -146,7 +143,7 @@ assert-css: (
146143
local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"}
147144
reload:
148145
// Waiting for the sidebar to be displayed...
149-
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
146+
wait-for-css: ("#sidebar-toggle", {"visibility": "visible"})
150147
assert-css: (
151148
"#source-sidebar details[open] > .files a.selected",
152149
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
@@ -201,7 +198,7 @@ assert-css: (
201198
size: (500, 700)
202199
reload:
203200
// Waiting for the sidebar to be displayed...
204-
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
201+
wait-for-css: ("#sidebar-toggle", {"visibility": "visible"})
205202

206203
// We now check it takes the full size of the display.
207204
assert-property: ("body", {"clientWidth": "500", "clientHeight": "700"})

0 commit comments

Comments
 (0)