Fix sidebar collapse flash on page navigation
Suppress CSS transitions during initial state restore from localStorage. Re-enable after two rAF frames so the toggle button still animates smoothly. Co-authored-by: Copilot <[email protected]>
This commit is contained in:
+11
-1
@@ -17,8 +17,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Restore saved state
|
||||
// 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';
|
||||
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.addEventListener('click', function () {
|
||||
|
||||
Reference in New Issue
Block a user