fix(ui): let revealed panels own their side and keep Cockpit's left strip

A panel a feature opens (Street Level's viewer, a selected radio station)
now becomes its side's open panel instead of being collapsed again by the
next layout pass. Cockpit keeps showing its collapsed Data Layers strip,
which Cyber's Cockpit layout aligns to, and Cyber's focus layout no longer
re-shows collapsed left panels. Both sidebars share one accordion helper.
This commit is contained in:
Sameh Khamis committed 2026-10-30 16:41:29 -07:00
1 parent 2035c767ce
commit eed7657516
9 files changed
+124 -58

No files matched your search

+14 -22
View File
@@ -5,6 +5,7 @@ import {
resolvePanelStackCorridor,
} from '../panelStackLayout.js';
import { measurePanelNaturalHeight } from './panelMeasurement.js';
import { settleSideAccordion } from './panelAccordion.js';
/**
* Measure and place the left panel rail for one synchronous layout pass.
@@ -60,35 +61,26 @@ export function layoutLeftPanelRail({
stack.style.removeProperty('--left-stack-centered-height');
stack.classList.remove('layout-exclusive');
stack.dataset.layoutMode = 'mobile';
settleSideAccordion({ panels, enabled: false, onCollapse });
for (const panel of panels) {
if (panel.classList.contains('accordion-collapsed')) {
panel.classList.remove('collapsed', 'accordion-collapsed');
onCollapse(panel);
}
panel.removeAttribute('aria-hidden');
panel.style.removeProperty('--left-panel-allocated-height');
}
return;
}
// One panel is open per desktop side and the panel rail lists the others,
// so collapsed panels are hidden. Normalize restored state without
// overwriting saved panel preferences.
const expandedBeforeAccordion = panels.filter(
(panel) => !panel.classList.contains('collapsed'),
);
const accordionOwner =
expandedBeforeAccordion.find((panel) => panel.id === preferredPanelId) ||
expandedBeforeAccordion.find((panel) =>
panel.contains(documentRef?.activeElement),
) ||
expandedBeforeAccordion[0];
for (const panel of expandedBeforeAccordion) {
if (panel === accordionOwner) continue;
panel.classList.add('collapsed', 'accordion-collapsed');
onCollapse(panel);
}
const exclusive = !isMobile;
// One panel is open per desktop side, and the panel rail lists the others,
// so collapsed panels are hidden. Cockpit keeps its collapsed Data Layers
// strip, which its layout aligns to, and shows no rail.
settleSideAccordion({
panels,
enabled: true,
preferredPanelId,
documentRef,
onCollapse,
});
const exclusive =
!isMobile && !documentRef?.body?.classList?.contains('cockpit-mode');
stack.classList.toggle('layout-exclusive', exclusive);
const laidOutPanels = panels.filter(
(panel) => !exclusive || !panel.classList.contains('collapsed'),