From 53ab36a5bfc51ddc33d35597b7cc29d39b390a0e Mon Sep 17 00:00:00 2001 From: Aru Sahni Date: Thu, 31 Dec 2020 19:14:28 -0500 Subject: [PATCH 1/2] Update sidebar CSS selector. This corrects a bug where the CSS selcetor to reposition the top of the rustdoc sidebar was no longer applied to the element. It also updates the magic number to be less magic. Fixes #1121 --- templates/style/rustdoc.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/style/rustdoc.scss b/templates/style/rustdoc.scss index 4939b1cdc..5c3770c6c 100644 --- a/templates/style/rustdoc.scss +++ b/templates/style/rustdoc.scss @@ -50,8 +50,8 @@ div.rustdoc { &.mobile { top: $top-navbar-height; - .sidebar-elems .show-it { - top: 77px; + .sidebar-elems.show-it { + top: 45px + $top-navbar-height; } #sidebar-filler { From 143d7c8a6ae6e334b61bfd065cb882118dae2890 Mon Sep 17 00:00:00 2001 From: Aru Sahni Date: Thu, 31 Dec 2020 20:21:02 -0500 Subject: [PATCH 2/2] Adjust sidebar nav sizing to account for rustdoc container padding. This addresses some visible jank caused by the sidebar nav container overflow changing the rendered size. --- templates/style/rustdoc.scss | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/style/rustdoc.scss b/templates/style/rustdoc.scss index 5c3770c6c..2079d4349 100644 --- a/templates/style/rustdoc.scss +++ b/templates/style/rustdoc.scss @@ -29,8 +29,9 @@ body.blur { // rustdoc overrides div.rustdoc { + $padding-x: 15px; font-family: $font-family-serif; - padding: 10px 15px 20px 15px; + padding: 10px $padding-x 20px; position: relative; @media (max-width: 700px) { @@ -47,8 +48,13 @@ 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 + width: 100%; .sidebar-elems.show-it { top: 45px + $top-navbar-height;