You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: preserve sidebar layout across hide/show to make expand near-instant
The CCB sidebar-toggle routed through `$sidebar.hide()` → `display:none`,
which Chromium handles by destroying the element's layout tree. On
re-show, the browser has to rebuild layout + paint for the entire
sidebar subtree — for the AI chat panel with a large history
(>1k messages) that was ~750ms of synchronous work per toggle, and
scrollTop on the messages container was zeroed along the way.
Add an opt-in visibility-based hide mode to Resizer: when an element
has the `layout-preserve-hide` class, Resizer toggles a `layout-hidden`
class (which applies `visibility: hidden; pointer-events: none`) instead
of calling `$element.hide()` / `$element.show()`. The element's layout
object stays alive across the toggle, so descendants keep their scroll
positions and `content-visibility` caches, and re-show has no layout
rebuild to do.
`Resizer.isVisible` and the drag-path `:visible` checks were updated to
consult the new class so toggle() / drag-to-reopen still work correctly.
Four callers that read `$sidebar.is(":visible")` were switched to
`SidebarView.isVisible()` (which delegates to the updated Resizer path),
since jQuery's `:visible` can't distinguish a visibility-hidden element
from a shown one.
Measured with a 1098-message AI chat (~10k DOM nodes): expand time on
the sidebar toggle dropped from 752ms → 49.7ms (~15x), scrollTop drift
is 0. Existing suites (mainview:CentralControlBar 50/50, mainview:SidebarTabs
37/37, integration:Navigation 6/6) all green.
0 commit comments