Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix position of source code pages sidebar #2332

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions gui-tests/sidebar.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Checks the sidebar display.
go-to: |DOC_PATH| + "/sysinfo"

set-window-size: (1000, 1000)

// First we check that the rustdoc sidebar is not overlaying the docs.rs topbar.
store-size: (".rustdoc-page .nav-container", {"height": topbar_height})
assert-position: (".rustdoc .sidebar", {"y": |topbar_height|, "x": 0})

// We check the same in "mobile mode".
set-window-size: (600, 1000)
assert-position: (".rustdoc .mobile-topbar", {"y": |topbar_height|, "x": 0})
// We check when the sidebar is shown now.
click: ".rustdoc .mobile-topbar .sidebar-menu-toggle"
wait-for: ".rustdoc .sidebar.shown"
// The mobile sidebar is supposed to be under the rustdoc mobile topbar + docs.rs topbar.
store-size: (".rustdoc .mobile-topbar", {"height": rustdoc_topbar_height})
assert-position: (".rustdoc .sidebar.shown", {
"y": |topbar_height| + |rustdoc_topbar_height|,
"x": 0,
})

// We reset the window's size.
set-window-size: (1000, 1000)

// We now go to the source code page.
wait-for: ".main-heading a.src"
click: ".main-heading a.src"

// We wait for the page to load...
wait-for: ".rustdoc.src"
// We check that the sidebar has the correct position.
assert-position: (".rustdoc .sidebar", {"y": |topbar_height|, "x": 0})
// We expand the sidebar.
click: "#src-sidebar-toggle button"
wait-for: ".src-sidebar-expanded"
// We check the position again.
assert-position: (".rustdoc .sidebar", {"y": |topbar_height|, "x": 0})

// We check in "mobile mode".
set-window-size: (600, 1000)
// We check the position again.
assert-position: (".rustdoc .sidebar", {"y": |topbar_height|, "x": 0})
3 changes: 0 additions & 3 deletions templates/style/_rustdoc-common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ div.rustdoc {
}

@media (max-width: 700px) {
margin-left: -2 * $padding-x; // offset the additional padding added by the parent containers
width: calc(100% + #{4 * $padding-x});

&.mobile {
top: $top-navbar-height;
margin-left: 0; // since the sidebar is now fixed position, remove the padding workaround
Expand Down
Loading