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

+7 -2
View File
@@ -4,16 +4,21 @@ import { readFileSync } from 'node:fs';
import test from 'node:test';
import { shouldExpandGlobalContextPanel } from './rightRailPolicy.js';
test('desktop side rails hide collapsed panels in every HUD layout, never on phones', () => {
test('desktop side rails hide collapsed panels in every HUD layout, never on phones or beside Cockpit', () => {
const right = readFileSync(new URL('./ui/rightPanelRail.js', import.meta.url), 'utf8');
const left = readFileSync(new URL('./ui/leftPanelRail.js', import.meta.url), 'utf8');
const css = readStylesheet(new URL('../style.css', import.meta.url));
for (const ui of [right, left]) {
assert.match(ui, /const isMobile = windowRef\.matchMedia\('\(max-width: 720px\)'\)\.matches/);
assert.match(ui, /const exclusive = !isMobile;/);
assert.match(ui, /if \(exclusive && panel\.classList\.contains\('collapsed'\)\)\s*panel\.setAttribute\('aria-hidden', 'true'\)/);
assert.doesNotMatch(ui, /hud\.variant === 'cyber'/);
}
assert.match(right, /const exclusive = !isMobile;/);
// Cockpit keeps its collapsed Data Layers strip, which its layout aligns to.
assert.match(
left,
/const exclusive =\s*!isMobile && !documentRef\?\.body\?\.classList\?\.contains\('cockpit-mode'\);/,
);
assert.match(css, /#right-context-rail\.layout-exclusive > \[data-panel-id\]\.collapsed \{/);
assert.match(css, /#left-panel-stack\.layout-exclusive > \[data-panel-id\]\.collapsed \{/);
});