about summary refs log tree commit diff
path: root/src/librustdoc/html/static/js/storage.js
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2023-09-27 08:59:32 -0700
committerMichael Howell <michael@notriddle.com>2023-10-11 10:26:38 -0700
commit273a302ac8a5fed73bb17988ed571339dc6217ad (patch)
treea5ae54369d04794191387063ca3d228eaf2478c7 /src/librustdoc/html/static/js/storage.js
parent210c88fc7ae55df147b45b9e75f95874c1a589ef (diff)
downloadrust-273a302ac8a5fed73bb17988ed571339dc6217ad.tar.gz
rust-273a302ac8a5fed73bb17988ed571339dc6217ad.zip
rustdoc: enforce BODY_MIN constraint on sidebar resize
Diffstat (limited to 'src/librustdoc/html/static/js/storage.js')
-rw-r--r--src/librustdoc/html/static/js/storage.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/librustdoc/html/static/js/storage.js b/src/librustdoc/html/static/js/storage.js
index 20220f2e69a..18a127fbbd1 100644
--- a/src/librustdoc/html/static/js/storage.js
+++ b/src/librustdoc/html/static/js/storage.js
@@ -196,18 +196,21 @@ if (getSettingValue("use-system-theme") !== "false" && window.matchMedia) {
 
 updateTheme();
 
+// Hide, show, and resize the sidebar at page load time
+//
+// This needs to be done here because this JS is render-blocking,
+// so that the sidebar doesn't "jump" after appearing on screen.
+// The user interaction to change this is set up in main.js.
 if (getSettingValue("source-sidebar-show") === "true") {
     // At this point in page load, `document.body` is not available yet.
     // Set a class on the `<html>` element instead.
     addClass(document.documentElement, "src-sidebar-expanded");
 }
-
 if (getSettingValue("hide-sidebar") === "true") {
     // At this point in page load, `document.body` is not available yet.
     // Set a class on the `<html>` element instead.
     addClass(document.documentElement, "hide-sidebar");
 }
-
 function updateSidebarWidth() {
     const desktopSidebarWidth = getSettingValue("desktop-sidebar-width");
     if (desktopSidebarWidth && desktopSidebarWidth !== "null") {