Skip to content

Source code scrollbar #109932

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

Merged
merged 2 commits into from
Apr 5, 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
4 changes: 4 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ img {
overflow-x: hidden;
/* The sidebar is by default hidden */
overflow-y: hidden;
z-index: 1;
}

.sidebar, .mobile-topbar, .sidebar-menu-toggle,
Expand Down Expand Up @@ -535,6 +536,9 @@ ul.block, .block li {
.rustdoc .example-wrap > pre {
margin: 0;
flex-grow: 1;
}

.rustdoc:not(.source) .example-wrap > pre {
overflow: auto hidden;
}

Expand Down
8 changes: 8 additions & 0 deletions tests/rustdoc-gui/source-code-page-code-scroll.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Checks that the scrollbar is visible on the page rather than the code block.
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
size: (800, 1000)
// "scrollWidth" should be superior than "clientWidth".
assert-property: ("body", {"scrollWidth": 1047, "clientWidth": 800})

// Both properties should be equal (ie, no scroll on the code block).
assert-property: (".example-wrap .rust", {"scrollWidth": 933, "clientWidth": 933})