Problem/Motivation
Sidebar open/close state was kept in three places that had to be manually held in sync: the per-panel {id}_sidebar cookie (server-side rendering), the navigation-plus-hidden DOM class, and an in-memory SidebarManager.active slot reconciled by a tracker behavior. Three stores aligned only by convention is fragile, and it produced occasional, hard-to-pin-down inconsistencies where a panel's shown/hidden state disagreed with what the user expected.
The per-panel cookie model also allowed states the runtime cannot represent: a side has at most one open panel, but each panel had an independent open/closed cookie, so a single side could carry several "open" panels at once.
Proposed resolution
Collapse the three stores to one authoritative source plus its projection:
- Replace the per-panel cookies with one cookie per side (
left_sidebar/right_sidebar) holding the id of the open panel, matching the one-panel-per-side invariant. - Remove the in-memory
SidebarManager.activestore and the tracker behavior; derive the open panel from the DOM via a newgetOpenPanel(side). - Cache each sidebar panel per user and vary it by exactly the inputs its visibility depends on (
cookies:{side}_sidebar, plusnavigationMode/activeToolwhen bound).
API changes
- JS: removed
SidebarManager.active; addedSidebarManager.getOpenPanel(side). Consumers readingactive.{side}must switch togetOpenPanel(side). - PHP:
NavigationPlusUi::isSidebarVisible()now takes(string $id, string $side, ?string $mode, ?string $tool). - Cookies: per-panel
{id}_sidebarreplaced by per-side{side}_sidebar. No migration needed; old cookies are ignored. - Consumers of the sidebar API (e.g. Edit+) need the release carrying this change.
Comments
Comment #3
tim bozeman commented