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.active store and the tracker behavior; derive the open panel from the DOM via a new getOpenPanel(side).
  • Cache each sidebar panel per user and vary it by exactly the inputs its visibility depends on (cookies:{side}_sidebar, plus navigationMode / activeTool when bound).

API changes

  • JS: removed SidebarManager.active; added SidebarManager.getOpenPanel(side). Consumers reading active.{side} must switch to getOpenPanel(side).
  • PHP: NavigationPlusUi::isSidebarVisible() now takes (string $id, string $side, ?string $mode, ?string $tool).
  • Cookies: per-panel {id}_sidebar replaced 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

tim bozeman created an issue. See original summary.

  • tim bozeman committed ac91fcb7 on 2.3.x
    task: #3607799 Collapse sidebar open/close state to a single per-side...
tim bozeman’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.