Skip to content

Commit

Permalink
Fix display of toggles on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Dec 30, 2021
1 parent b77830d commit 7c78ea5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -2007,6 +2007,16 @@ details.rustdoc-toggle[open] > summary.hideme::after {
max-width: 100vw;
width: 100vw;
}

/* Position of the "[-]" element. */
details.rustdoc-toggle:not(.top-doc) > summary {
margin-left: 10px;
}
.impl-items > details.rustdoc-toggle > summary:not(.hideme)::before,
#main-content > details.rustdoc-toggle:not(.top-doc) > summary::before,
#main-content > div > details.rustdoc-toggle > summary::before {
left: -11px;
}
}

@media print {
Expand Down
10 changes: 10 additions & 0 deletions src/test/rustdoc-gui/toggle-docs-mobile.goml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ assert-attribute: (".top-doc", {"open": ""})
click: (3, 280)
assert-attribute: (".top-doc", {"open": ""})

// Assert the position of the toggle on the top doc block.
assert-position: (".top-doc summary::before", {"x": 4})
// Assert the position of the toggle on the impl block.
assert-position: ("#implementations + details > summary::before", {"x": 4})
// Assert the position of the toggle on a method.
assert-position: (
"#trait-implementations-list .impl-items .method-toggle > summary::before",
{"x": 4},
)

// Now we do the same but with a little bigger width
size: (600, 600)
assert-attribute: (".top-doc", {"open": ""})
Expand Down

0 comments on commit 7c78ea5

Please sign in to comment.