mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-13 23:42:56 +00:00
Fix scroll offset when jumping to internal id
This commit is contained in:
parent
e5e2b0be26
commit
801ac0e24f
@ -1738,12 +1738,19 @@ details.rustdoc-toggle[open] > summary.hideme::after {
|
||||
}
|
||||
|
||||
@media (max-width: 700px) {
|
||||
/* When linking to an item with an `id` (for instance, by clicking a link in the sidebar,
|
||||
or visiting a URL with a fragment like `#method.new`, we don't want the item to be obscured
|
||||
by the topbar. Anything with an `id` gets scroll-margin-top equal to .mobile-topbar's size.
|
||||
*/
|
||||
*[id] {
|
||||
scroll-margin-top: 45px;
|
||||
}
|
||||
|
||||
.rustdoc {
|
||||
padding-top: 0px;
|
||||
/* Sidebar should overlay main content, rather than pushing main content to the right.
|
||||
Turn off `display: flex` on the body element. */
|
||||
display: block;
|
||||
scroll-margin-top: 45px;
|
||||
}
|
||||
|
||||
main {
|
||||
|
@ -29,3 +29,9 @@ assert-css: (".sidebar", {"display": "block", "left": "-1000px"})
|
||||
|
||||
// Check that the topbar is visible
|
||||
assert-property: (".mobile-topbar", {"clientHeight": "45"})
|
||||
|
||||
// Check that clicking an element from the sidebar scrolls to the right place
|
||||
// so the target is not obscured by the topbar.
|
||||
click: ".sidebar-menu-toggle"
|
||||
click: ".sidebar-links a"
|
||||
assert-position: ("#method\.must_use", {"y": 45})
|
||||
|
Loading…
Reference in New Issue
Block a user