From ebee589bc085f0ac5750369cd4ee4c6a6b49f9dd Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 16 Nov 2022 22:52:30 -0700 Subject: [PATCH] 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. [flex-basis]: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis --- src/librustdoc/html/static/css/rustdoc.css | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 9b1cac85cfd58..6d34183bd0178 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -387,8 +387,7 @@ img { .sidebar { font-size: 0.875rem; - width: 200px; - min-width: 200px; + flex: 0 0 200px; overflow-y: scroll; position: sticky; height: 100vh; @@ -397,12 +396,7 @@ img { } .rustdoc.source .sidebar { - width: 50px; - min-width: 0px; - max-width: 300px; - flex-grow: 0; - flex-shrink: 0; - flex-basis: auto; + flex-basis: 50px; border-right: 1px solid; overflow-x: hidden; /* The sidebar is by default hidden */ @@ -423,7 +417,7 @@ img { .source-sidebar-expanded .source .sidebar { overflow-y: auto; - width: 300px; + flex-basis: 300px; } .source-sidebar-expanded .source .sidebar > *:not(#sidebar-toggle) { @@ -1702,6 +1696,7 @@ in storage.js z-index: 11; /* Reduce height slightly to account for mobile topbar. */ height: calc(100vh - 45px); + width: 200px; } /* The source view uses a different design for the sidebar toggle, and doesn't have a topbar,