diff options
| author | Michael Howell <michael@notriddle.com> | 2023-09-27 08:59:32 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2023-10-11 10:26:38 -0700 |
| commit | 273a302ac8a5fed73bb17988ed571339dc6217ad (patch) | |
| tree | a5ae54369d04794191387063ca3d228eaf2478c7 /src/librustdoc/html/static/js/storage.js | |
| parent | 210c88fc7ae55df147b45b9e75f95874c1a589ef (diff) | |
| download | rust-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.js | 7 |
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") { |
