Skip to content

Commit

Permalink
Auto merge of rust-lang#131417 - GuillaumeGomez:mobile-methods-left-m…
Browse files Browse the repository at this point in the history
…argin, 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`
  • Loading branch information
bors committed Oct 9, 2024
2 parents a1eceec + 9e041fa commit aace1d5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -2435,7 +2435,7 @@ in src-script.js and main.js
}

/* Position of the "[-]" element. */
details.toggle:not(.top-doc) > summary {
details.toggle:not(.top-doc) > summary, .impl-items > section {
margin-left: 10px;
}
.impl-items > details.toggle > summary:not(.hideme)::before,
Expand Down
17 changes: 17 additions & 0 deletions tests/rustdoc-gui/methods-left-margin.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// This test is to ensure that methods are correctly aligned on the left side.

go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"

// First we ensure that we have methods with and without documentation.
assert: ".impl-items > details.method-toggle > summary > section.method"
assert: ".impl-items > section.method"

// Checking on desktop.
set-window-size: (900, 600)
store-position: (".impl-items section.method", {"x": x})
assert-position: (".impl-items section.method", {"x": |x|}, ALL)

// Checking on mobile.
set-window-size: (600, 600)
store-position: (".impl-items section.method", {"x": x})
assert-position: (".impl-items section.method", {"x": |x|}, ALL)
4 changes: 2 additions & 2 deletions tests/rustdoc-gui/notable-trait.goml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ call-function: ("check-notable-tooltip-position", {
// Checking on mobile now.
set-window-size: (650, 600)
call-function: ("check-notable-tooltip-position-complete", {
"x": 15,
"i_x": 293,
"x": 25,
"i_x": 303,
"popover_x": 0,
})

Expand Down

0 comments on commit aace1d5

Please sign in to comment.