Skip to content

Commit

Permalink
rustdoc: fix up sidebar width on browser back
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Sep 8, 2023
1 parent e496f50 commit 96836e7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/librustdoc/html/static/js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ if (getSettingValue("hide-sidebar") === "true") {
addClass(document.documentElement, "hide-sidebar");
}

(function() {
function updateSidebarWidth() {
const desktopSidebarWidth = getSettingValue("desktop-sidebar-width");
if (desktopSidebarWidth) {
document.documentElement.style.setProperty(
Expand All @@ -209,7 +209,7 @@ if (getSettingValue("hide-sidebar") === "true") {
srcSidebarWidth + "px"
);
}
}());
};

// If we navigate away (for example to a settings page), and then use the back or
// forward button to get back to a page, the theme may have changed in the meantime.
Expand All @@ -223,5 +223,6 @@ if (getSettingValue("hide-sidebar") === "true") {
window.addEventListener("pageshow", ev => {
if (ev.persisted) {
setTimeout(updateTheme, 0);
setTimeout(updateSidebarWidth, 0);
}
});

0 comments on commit 96836e7

Please sign in to comment.