Skip to content

Commit 540edc7

Browse files
authored
Rollup merge of #104516 - notriddle:notriddle/flex-basis-sidebar-width, r=GuillaumeGomez
rustdoc: clean up sidebar width CSS This commit takes advantage of the ability to set [flex-basis] to a specific length instead of setting it to `auto` and changing min-/max-width, and setting flex-grow/-shrink both to 0. This PR should not cause any visual changes. preview: https://notriddle.com/notriddle-rustdoc-demos/flex-basis-sidebar-width/std/index.html [flex-basis]: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis
2 parents 57a93bf + ebee589 commit 540edc7

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

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

+4-9
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,7 @@ img {
384384

385385
.sidebar {
386386
font-size: 0.875rem;
387-
width: 200px;
388-
min-width: 200px;
387+
flex: 0 0 200px;
389388
overflow-y: scroll;
390389
position: sticky;
391390
height: 100vh;
@@ -394,12 +393,7 @@ img {
394393
}
395394

396395
.rustdoc.source .sidebar {
397-
width: 50px;
398-
min-width: 0px;
399-
max-width: 300px;
400-
flex-grow: 0;
401-
flex-shrink: 0;
402-
flex-basis: auto;
396+
flex-basis: 50px;
403397
border-right: 1px solid;
404398
overflow-x: hidden;
405399
/* The sidebar is by default hidden */
@@ -420,7 +414,7 @@ img {
420414

421415
.source-sidebar-expanded .source .sidebar {
422416
overflow-y: auto;
423-
width: 300px;
417+
flex-basis: 300px;
424418
}
425419

426420
.source-sidebar-expanded .source .sidebar > *:not(#sidebar-toggle) {
@@ -1699,6 +1693,7 @@ in storage.js
16991693
z-index: 11;
17001694
/* Reduce height slightly to account for mobile topbar. */
17011695
height: calc(100vh - 45px);
1696+
width: 200px;
17021697
}
17031698

17041699
/* The source view uses a different design for the sidebar toggle, and doesn't have a topbar,

0 commit comments

Comments
 (0)