Skip to content

Commit cc5a9ca

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

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

+4-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,8 @@ if (getSettingValue("hide-sidebar") === "true") {
209209
srcSidebarWidth + "px"
210210
);
211211
}
212-
}());
212+
};
213+
updateSidebarWidth();
213214

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

0 commit comments

Comments
 (0)