From 2f1e35414d3e859931515f545a7a1713418e5d2b Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Mon, 10 Aug 2026 05:04:57 -0400 Subject: [PATCH] Fix sidebar arrow direction: use CSS rotation not JS icon swap The CSS already handles the arrow direction with transform:rotate(180deg) on .app-sidebar.collapsed .sidebar-collapse-btn. The JS icon className swap was fighting with CSS rotation causing a double-flip. Remove JS icon manipulation, let CSS handle it. Also suppress the button transition on page load. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- static/js/theme.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/static/js/theme.js b/static/js/theme.js index 39af3aa..ab539a4 100644 --- a/static/js/theme.js +++ b/static/js/theme.js @@ -11,22 +11,20 @@ function applyCollapsed(collapsed) { sidebar.classList.toggle('collapsed', collapsed); contentWrapper.classList.toggle('sidebar-collapsed', collapsed); - const icon = toggleBtn && toggleBtn.querySelector('i'); - if (icon) { - icon.className = collapsed ? 'fas fa-chevron-right' : 'fas fa-chevron-left'; - } } // Restore saved state instantly — suppress transitions so there's no // collapse animation flash on every page navigation. sidebar.style.transition = 'none'; contentWrapper.style.transition = 'none'; + if (toggleBtn) toggleBtn.style.transition = 'none'; applyCollapsed(localStorage.getItem(COLLAPSED_KEY) === '1'); // Re-enable transitions after one frame so the toggle button still animates. requestAnimationFrame(function () { requestAnimationFrame(function () { sidebar.style.transition = ''; contentWrapper.style.transition = ''; + if (toggleBtn) toggleBtn.style.transition = ''; }); });