Skip to content

Commit ee63b65

Browse files
authored
Rollup merge of #109932 - GuillaumeGomez:source-code-scrollbar, r=notriddle
Source code scrollbar Fixes #109865. You can test it [here](https://rustdoc.crud.net/imperio/source-code-scrollbar/src/test_docs/lib.rs.html). It seems to introduce a few regressions (at least change of behaviour) about the scroll "saving" though. r? `@notriddle`
2 parents 30ffbc4 + 8aef0c7 commit ee63b65

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/librustdoc/html/static/css/rustdoc.css

+4
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ img {
392392
overflow-x: hidden;
393393
/* The sidebar is by default hidden */
394394
overflow-y: hidden;
395+
z-index: 1;
395396
}
396397

397398
.sidebar, .mobile-topbar, .sidebar-menu-toggle,
@@ -535,6 +536,9 @@ ul.block, .block li {
535536
.rustdoc .example-wrap > pre {
536537
margin: 0;
537538
flex-grow: 1;
539+
}
540+
541+
.rustdoc:not(.source) .example-wrap > pre {
538542
overflow: auto hidden;
539543
}
540544

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Checks that the scrollbar is visible on the page rather than the code block.
2+
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
3+
size: (800, 1000)
4+
// "scrollWidth" should be superior than "clientWidth".
5+
assert-property: ("body", {"scrollWidth": 1047, "clientWidth": 800})
6+
7+
// Both properties should be equal (ie, no scroll on the code block).
8+
assert-property: (".example-wrap .rust", {"scrollWidth": 933, "clientWidth": 933})

0 commit comments

Comments
 (0)