Fix animation bug in safari

When showing the sidebar, Safari was causing the sidebar to snap into
place without animating. This is apparently some well-known issue where
it doesn't like adding new elements (or changing display) and toggling
an animated transition in the same event loop.
This commit is contained in:
Eric Huss 2025-07-07 09:47:28 -07:00
parent 16b99be17f
commit d1c09791ab

View file

@ -540,6 +540,10 @@ aria-label="Show hidden lines"></button>';
/* To allow the sidebar expansion animation, we first need to put back the display. */
if (!sidebarCheckbox.checked) {
sidebar.style.display = '';
// Workaround for Safari skipping the animation when changing
// `display` and a transform in the same event loop. This forces a
// reflow after updating the display.
sidebar.offsetHeight;
}
});