Skip to content

Commit 47344c3

Browse files
authored
Rollup merge of #131417 - GuillaumeGomez:mobile-methods-left-margin, r=notriddle
Fix methods alignment on mobile I realized that on mobile, the methods are not aligned the same depending if they have documentation or not: | before | after | |-|-| | ![Screenshot from 2024-10-08 20-40-22](https://github.com/user-attachments/assets/d31ba5e1-cf84-431f-9b2b-9962bc5a0365) | ![image](https://github.com/user-attachments/assets/ffde2161-bfcb-4462-8c5b-88538e61b366) | r? `@notriddle`
2 parents 50f7e80 + 5e6033e commit 47344c3

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -2435,7 +2435,7 @@ in src-script.js and main.js
24352435
}
24362436

24372437
/* Position of the "[-]" element. */
2438-
details.toggle:not(.top-doc) > summary {
2438+
details.toggle:not(.top-doc) > summary, .impl-items > section {
24392439
margin-left: 10px;
24402440
}
24412441
.impl-items > details.toggle > summary:not(.hideme)::before,
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// This test is to ensure that methods are correctly aligned on the left side.
2+
3+
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
4+
5+
// First we ensure that we have methods with and without documentation.
6+
assert: ".impl-items > details.method-toggle > summary > section.method"
7+
assert: ".impl-items > section.method"
8+
9+
// Checking on desktop.
10+
set-window-size: (900, 600)
11+
wait-for-size: ("body", {"width": 900})
12+
store-position: (".impl-items section.method", {"x": x})
13+
assert-position: (".impl-items section.method", {"x": |x|}, ALL)
14+
15+
// Checking on mobile.
16+
set-window-size: (600, 600)
17+
wait-for-size: ("body", {"width": 600})
18+
store-position: (".impl-items section.method", {"x": x})
19+
assert-position: (".impl-items section.method", {"x": |x|}, ALL)

tests/rustdoc-gui/notable-trait.goml

+3-2
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ call-function: ("check-notable-tooltip-position", {
8484

8585
// Checking on mobile now.
8686
set-window-size: (650, 600)
87+
wait-for-size: ("body", {"width": 650})
8788
call-function: ("check-notable-tooltip-position-complete", {
88-
"x": 15,
89-
"i_x": 293,
89+
"x": 25,
90+
"i_x": 303,
9091
"popover_x": 0,
9192
})
9293

0 commit comments

Comments
 (0)