Skip to content

Commit 96836e7

Browse files
committed
rustdoc: fix up sidebar width on browser back
1 parent e496f50 commit 96836e7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/librustdoc/html/static/js/storage.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ if (getSettingValue("hide-sidebar") === "true") {
194194
addClass(document.documentElement, "hide-sidebar");
195195
}
196196

197-
(function() {
197+
function updateSidebarWidth() {
198198
const desktopSidebarWidth = getSettingValue("desktop-sidebar-width");
199199
if (desktopSidebarWidth) {
200200
document.documentElement.style.setProperty(
@@ -209,7 +209,7 @@ if (getSettingValue("hide-sidebar") === "true") {
209209
srcSidebarWidth + "px"
210210
);
211211
}
212-
}());
212+
};
213213

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

0 commit comments

Comments
 (0)