Skip to content

Commit 21627eb

Browse files
authored
Rollup merge of rust-lang#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 8bdf178 + 9e041fa commit 21627eb

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-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,
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
store-position: (".impl-items section.method", {"x": x})
12+
assert-position: (".impl-items section.method", {"x": |x|}, ALL)
13+
14+
// Checking on mobile.
15+
set-window-size: (600, 600)
16+
store-position: (".impl-items section.method", {"x": x})
17+
assert-position: (".impl-items section.method", {"x": |x|}, ALL)

tests/rustdoc-gui/notable-trait.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ call-function: ("check-notable-tooltip-position", {
8585
// Checking on mobile now.
8686
set-window-size: (650, 600)
8787
call-function: ("check-notable-tooltip-position-complete", {
88-
"x": 15,
89-
"i_x": 293,
88+
"x": 25,
89+
"i_x": 303,
9090
"popover_x": 0,
9191
})
9292

0 commit comments

Comments
 (0)