Hand focus to a rail entry when a panel folds it away

- When F or a panel's collapse button folds a panel that holds the focus,
  the focus moves to that panel's visible rail entry. The same happens when
  opening Data Layers folds a peer panel that held it, and in Cockpit the
  focus moves to Contact's expand button when that card folds.
- The `shownBy: 'active'` rail gate is gone: nothing removes `.active` from
  Data Layers any more, so a rail entry now follows `panel.hidden`.
- CURRENT-STATE says what F does, and the panel catalog comment no longer
  says F toggles `.active`.
This commit is contained in:
German Khokhlov committed 2026-11-19 15:00:17 +04:00
1 parent 3a24768a2d
commit c7df3c6798
9 files changed
+179 -40

No files matched your search

+2 -4
View File
@@ -22,8 +22,6 @@ function panel(id, { collapsed = true, hidden = false, title = '' } = {}) {
element.className = collapsed
? 'panel-collapsible collapsed'
: 'panel-collapsible';
// Data Layers shows only while `active` (the `f` shortcut toggles it).
if (id === 'data-panel') element.classList.add('active');
element.hidden = hidden;
if (title) element.innerHTML = `<span class="panel-title">${title}</span>`;
return element;
@@ -132,8 +130,8 @@ test('the rails follow disclosure and availability changes', async () => {
['global-context-panel', 'false'],
['host-panel', 'false'],
]);
// `f` hides Data Layers outright, so the rail stops offering it.
document.getElementById('data-panel').classList.remove('active');
// A hidden panel leaves its rail.
document.getElementById('data-panel').hidden = true;
await new Promise((resolve) => setTimeout(resolve, 0));
await nextTick();
assert.deepEqual(railItems(left), [['scene-panel', 'true']]);