From 28ee3bfc3748c60af1dba027a655fe344b1ea168 Mon Sep 17 00:00:00 2001 From: Said Turksever Date: Fri, 6 Nov 2026 00:47:52 +0000 Subject: [PATCH 01/13] Keep app shortcuts off Cmd/Ctrl/Alt combos; F collapses the layer panel like its button --- src/ui/applicationShell.js | 1 + src/ui/applicationShortcuts.js | 5 +++++ src/ui/displayBindings.js | 4 ++-- src/ui/visualInput.test.mjs | 14 ++++++++++++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/ui/applicationShell.js b/src/ui/applicationShell.js index ac921b34b5..1e4daaefdb 100644 --- a/src/ui/applicationShell.js +++ b/src/ui/applicationShell.js @@ -542,6 +542,7 @@ export class StyleManager extends ShellFacade { _toggleOrbit: (...args) => this._toggleOrbit(...args), toggleCleanView: (...args) => this.toggleCleanView(...args), _toggleCctvEnabled: (...args) => this._toggleCctvEnabled(...args), + _togglePanel: (panelId) => this._panelChrome._togglePanel(panelId), _setBloomEnabled: (...args) => this._setBloomEnabled(...args), _setBloomIntensity: (...args) => this._setBloomIntensity(...args), _setSharpenEnabled: (...args) => this._setSharpenEnabled(...args), diff --git a/src/ui/applicationShortcuts.js b/src/ui/applicationShortcuts.js index 57214a570d..d83e0caab2 100644 --- a/src/ui/applicationShortcuts.js +++ b/src/ui/applicationShortcuts.js @@ -27,6 +27,11 @@ export function bindApplicationShortcuts({ event.target?.matches?.('select, input, textarea') || event.target === searchInput; if (isFormControl && event.key !== 'Escape') return; + // Browser and OS shortcuts (Cmd+C, Ctrl+F, Alt+1…) are not ours. + if (event.metaKey || event.ctrlKey || event.altKey) { + if (event.key === 'Escape') actions.dismissSearch(); + return; + } if (STYLE_KEYS[event.key]) actions.setStyle(STYLE_KEYS[event.key]); if (event.key === 'Escape') actions.dismissSearch(); diff --git a/src/ui/displayBindings.js b/src/ui/displayBindings.js index 73c4fbee68..5a00dc6631 100644 --- a/src/ui/displayBindings.js +++ b/src/ui/displayBindings.js @@ -64,8 +64,8 @@ export class DisplayBindings { }, toggleOrbit: () => this._toggleOrbit(), toggleCleanView: () => this.toggleCleanView(), - toggleLayers: () => - document.getElementById('data-panel').classList.toggle('active'), + // Same collapse as the panel's own button, so its rail entry stays. + toggleLayers: () => this._togglePanel('data-panel'), cycleDetection: () => { this.shareLinkManager?.claimRestoreLane?.('visual'); this.claimDetection(); diff --git a/src/ui/visualInput.test.mjs b/src/ui/visualInput.test.mjs index d49a19bda0..82ca6beccd 100644 --- a/src/ui/visualInput.test.mjs +++ b/src/ui/visualInput.test.mjs @@ -117,9 +117,19 @@ test('the supplied search target retains editing even without form markup', () = assert.deepEqual(f.calls, [['dismissSearch']]); }); -test('shortcut extraction does not change repeat or modifier policy', () => { +test('browser shortcuts with Cmd, Ctrl or Alt never reach app shortcuts', () => { const f = shortcuts(); - f.press('h', new Element(), { repeat: true, ctrlKey: true }); + for (const modifier of ['metaKey', 'ctrlKey', 'altKey']) + for (const key of ['1', 'h', 'o', 'v', 'f', 'd', 'c']) + f.press(key, new Element(), { [modifier]: true }); + assert.deepEqual(f.calls, []); + f.press('Escape', new Element(), { metaKey: true }); + assert.deepEqual(f.calls, [['dismissSearch']]); +}); + +test('a held key still repeats its shortcut', () => { + const f = shortcuts(); + f.press('h', new Element(), { repeat: true }); assert.deepEqual(f.calls, [['toggleHud']]); }); From d3904b9503b203d7541f8f29f362c9e4efc7e720 Mon Sep 17 00:00:00 2001 From: Said Turksever Date: Fri, 6 Nov 2026 11:59:27 +0000 Subject: [PATCH 02/13] Changelog: 1598 fragment --- changelog.d/1598-shortcuts-modifier-keys.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog.d/1598-shortcuts-modifier-keys.md diff --git a/changelog.d/1598-shortcuts-modifier-keys.md b/changelog.d/1598-shortcuts-modifier-keys.md new file mode 100644 index 0000000000..80c30dde51 --- /dev/null +++ b/changelog.d/1598-shortcuts-modifier-keys.md @@ -0,0 +1,5 @@ +- Keep single-key app shortcuts off Cmd, Ctrl and Alt combinations, so Cmd+F, + Cmd+C and Cmd+R reach the browser instead of hiding the layer panel or + switching layers on. `F` now collapses the layer panel the way its button + does, instead of hiding the panel and the button that brings it back + (asturksever, #1598). From 89ebfa85d1f1f82fc91fef1f938b468369d9f422 Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Wed, 18 Nov 2026 19:00:04 +0400 Subject: [PATCH 03/13] Changelog: describe only the F change for 1598 --- changelog.d/1598-f-collapses-data-layers.md | 4 ++++ changelog.d/1598-shortcuts-modifier-keys.md | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 changelog.d/1598-f-collapses-data-layers.md delete mode 100644 changelog.d/1598-shortcuts-modifier-keys.md diff --git a/changelog.d/1598-f-collapses-data-layers.md b/changelog.d/1598-f-collapses-data-layers.md new file mode 100644 index 0000000000..e0f4df4973 --- /dev/null +++ b/changelog.d/1598-f-collapses-data-layers.md @@ -0,0 +1,4 @@ +- `F` now collapses and reopens the Data Layers panel the way the panel's own + button does, and its rail entry stays. Before, `F` hid the panel together + with its rail entry, so only another `F` brought it back (asturksever, + #1598). diff --git a/changelog.d/1598-shortcuts-modifier-keys.md b/changelog.d/1598-shortcuts-modifier-keys.md deleted file mode 100644 index 80c30dde51..0000000000 --- a/changelog.d/1598-shortcuts-modifier-keys.md +++ /dev/null @@ -1,5 +0,0 @@ -- Keep single-key app shortcuts off Cmd, Ctrl and Alt combinations, so Cmd+F, - Cmd+C and Cmd+R reach the browser instead of hiding the layer panel or - switching layers on. `F` now collapses the layer panel the way its button - does, instead of hiding the panel and the button that brings it back - (asturksever, #1598). From 3a24768a2dd85175d24ca24604472c4bda05b351 Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Wed, 18 Nov 2026 19:02:17 +0400 Subject: [PATCH 04/13] Test that F collapses Data Layers through PanelChrome and keeps its rail entry --- src/ui/panelChromeButtons.test.mjs | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/ui/panelChromeButtons.test.mjs b/src/ui/panelChromeButtons.test.mjs index 75678f8e62..75d9e72493 100644 --- a/src/ui/panelChromeButtons.test.mjs +++ b/src/ui/panelChromeButtons.test.mjs @@ -14,6 +14,8 @@ import PanelCollapseButton from './rail/PanelCollapseButton.vue'; import RailPanel from './rail/RailPanel.vue'; import UiPanel from './kit/UiPanel.vue'; import { usePanelChromeStore } from './stores/panelChrome.js'; +import { useDisplayStore } from './stores/display.js'; +import { DisplayBindings } from './displayBindings.js'; import CommandDockView from './views/CommandDockView.vue'; function mount(t, component) { @@ -462,3 +464,46 @@ test('the accordion closes peers through the real store, and opens them again', assert.equal(panels[0].className, ''); chrome.destroy(); }); + +test('F collapses Data Layers like its button and keeps its rail entry', (t) => { + document.body.innerHTML = ` +
`; + const panel = document.getElementById('data-panel'); + const store = usePanelChromeStore(createPinia()); + const chrome = panelChrome(store); + followPanelState(store, 'data-panel', panel); + chrome._disclosurePanelIds = new Set(['data-panel']); + const bindings = new DisplayBindings({ + viewer: null, + services: { isScopeMaskEnabled: () => false, cycleDetectionMode() {} }, + elements: { _locationSearch: document.createElement('input') }, + operations: { + _setScope() {}, + _togglePanel: (panelId) => chrome._togglePanel(panelId), + }, + readState: () => ({}), + claimDetection() {}, + displayStore: useDisplayStore(createPinia()), + }); + bindings._initUI(); + t.after(() => { + bindings.destroy(); + chrome.destroy(); + }); + const press = (init = {}) => + document.body.dispatchEvent( + new KeyboardEvent('keydown', { key: 'f', bubbles: true, ...init }), + ); + + press(); + assert.equal(store.panels['data-panel']?.collapsed, true); + assert.ok(panel.classList.contains('collapsed')); + // `active` is what keeps Data Layers in the rail. + assert.ok(panel.classList.contains('active')); + press({ metaKey: true }); + assert.equal(store.panels['data-panel'].collapsed, true, 'Cmd+F is not ours'); + press(); + assert.equal(store.panels['data-panel'].collapsed, false); + assert.ok(!panel.classList.contains('collapsed')); + assert.ok(panel.classList.contains('active')); +}); From 5301a0af8dbbf30a6294f9bc935edcc43e2d5673 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 02:45:21 -0800 Subject: [PATCH 05/13] Vue kit: the welcome card's buttons are UiButtons and its glyphs UiIcons SKIP, the three start tiles, BROWSE STORIES, BACK and the main NEXT / ENTER GOD MODE action are ghost UiButtons; the start tiles are pressed toggles, and the others keep aria-disabled so they stay focusable while the card is busy. The tile, tip, Stories and arrow glyphs are UiIcons sized by first-run.css. God mode's preview globe and callouts stay inline SVG drawings. A guard test pins it, the dismiss markup pin allows the kit classes, and the first-run mutation anchors follow the new tile markup. Co-authored-by: Manjunath Paparaju --- docs/VUE-MIGRATION.md | 8 ++++++ scripts/format-scope.json | 1 + scripts/qa-firstrun-mutations.mjs | 8 +++--- src/firstRunExperience.test.mjs | 2 +- src/ui/kit/welcomeControls.test.mjs | 37 +++++++++++++++++++++++++ src/ui/views/WelcomeView.vue | 42 +++++++++++++++-------------- 6 files changed, 73 insertions(+), 25 deletions(-) create mode 100644 src/ui/kit/welcomeControls.test.mjs diff --git a/docs/VUE-MIGRATION.md b/docs/VUE-MIGRATION.md index 35d0deffc9..9dfee07595 100644 --- a/docs/VUE-MIGRATION.md +++ b/docs/VUE-MIGRATION.md @@ -89,6 +89,14 @@ tilt-map button, whose owners still write their state into the DOM. Core's pressable chips and pills (rail card chips, map sources, cities and places) are `UiButton`s too; `UiChip` is a non-interactive label chip, used by the voice card. +The welcome card's buttons (SKIP, the three start tiles, BROWSE STORIES, +BACK and the main NEXT / ENTER GOD MODE action) are ghost `UiButton`s: +the start tiles are pressed toggles, and all but SKIP keep `aria-disabled` +rather than `disabled`, so they stay focusable while the card is busy. Its +tile, tip, Stories and arrow glyphs are `UiIcon`s with `:size="null"`, so +first-run.css still sizes them (`src/ui/kit/welcomeControls.test.mjs` pins +it). God mode's preview globe and callouts stay inline SVG drawings, and +its outbound links stay links. `UiSelect` renders the bare native select (Core's labels sit outside it or come as an `aria-label`) with `v-model`, `options` and `disabled`; options that carry their own attributes come through the slot, a caller's diff --git a/scripts/format-scope.json b/scripts/format-scope.json index 7dc54bc407..abc77b56d7 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -1343,6 +1343,7 @@ "src/ui/kit/UiDialog.vue", "src/ui/kit/UiDialog.test.mjs", "src/ui/kit/dialogs.test.mjs", + "src/ui/kit/welcomeControls.test.mjs", "src/ui/styles/chip.css", "src/ui/styles/empty-state.css", "src/ui/rail/RailChips.vue", diff --git a/scripts/qa-firstrun-mutations.mjs b/scripts/qa-firstrun-mutations.mjs index 7177daceee..9bce1d3fd6 100644 --- a/scripts/qa-firstrun-mutations.mjs +++ b/scripts/qa-firstrun-mutations.mjs @@ -444,14 +444,14 @@ const MUTATIONS = [ { defect: 'a mission tile is dropped from the menu', file: 'html', - from: ' +

{{ t(TITLES[step - 1]) }}

{{ t(TITLES[step - 1]) }}

@@ -207,22 +209,22 @@ function onSuppress(event) {

{{ t('Start with') }}

- - - +
@@ -230,17 +232,17 @@ function onSuppress(event) {
  • - + {{ t('Turn on layers') }} {{ t('Turn layers on to see flights, ships, cameras, weather and more.') }}
  • - + {{ t('Click anything') }} {{ t('Select a map item to see its details.') }}
  • @@ -248,12 +250,12 @@ function onSuppress(event) {

    {{ t('Go deeper') }}

    @@ -304,10 +306,10 @@ function onSuppress(event) {

    {{ launcher?.status ?? '' }}

    - - + {{ t('BACK') }} + + {{ step < STEPS ? t('NEXT') : t('ENTER GOD MODE') }} +
From 1393a025b473b1d4ff5757853cc95a638764ece2 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 02:55:03 -0800 Subject: [PATCH 06/13] Vue kit: the Visual panel's buttons are UiButtons and its glyphs UiIcons HUD, Clean UI, Bloom, Sharpen and Reset to default are ghost UiButtons; HUD, Bloom and Sharpen are pressed toggles with the active class, as Sonar, 3D and Celestial already were. The Scope, Celestial, sky, application-row and Reset glyphs are UiIcons sized by the panel's own rules. The toggles' text glyphs stay plain spans, since they are characters rather than Material symbols. A guard test pins it, and the initial-markup test allows the kit classes beside the toggle's own. The migration notes no longer claim every pressed toggle is a UiButton. Co-authored-by: Manjunath Paparaju --- docs/VUE-MIGRATION.md | 18 ++++++++-- scripts/format-scope.json | 1 + src/ui/displayPanel.test.mjs | 6 +++- src/ui/kit/visualControls.test.mjs | 53 ++++++++++++++++++++++++++++ src/ui/views/panels/DisplayPanel.vue | 31 ++++++++-------- 5 files changed, 90 insertions(+), 19 deletions(-) create mode 100644 src/ui/kit/visualControls.test.mjs diff --git a/docs/VUE-MIGRATION.md b/docs/VUE-MIGRATION.md index 35d0deffc9..b022fea3e4 100644 --- a/docs/VUE-MIGRATION.md +++ b/docs/VUE-MIGRATION.md @@ -83,12 +83,24 @@ segmented group in Core is a `UiSegmented`; the old `segmentedControl.js` adapter is gone. `UiButton` adds `pressedClass`, Core's class on a pressed toggle (most use `active`); its pressed classes toggle through `classList`, so a class other -code adds (a voice highlight) survives a press. Every pressed toggle in the -views is a `UiButton` except Bhote Koshi's cinematic button and the -tilt-map button, whose owners still write their state into the DOM. Core's +code adds (a voice highlight) survives a press. Not every pressed toggle in +the views is one yet: the entity card, the context view, the Layer Finder, +the Stories screens and a few panel buttons still hand-write theirs, and +Bhote Koshi's cinematic button and the tilt-map button have owners that +write their state into the DOM. Core's pressable chips and pills (rail card chips, map sources, cities and places) are `UiButton`s too; `UiChip` is a non-interactive label chip, used by the voice card. +The Visual panel's buttons (its presets and map sources, HUD, Sonar, +Detection, 3D, Clean UI, Celestial, Bloom, Sharpen and Reset to default) are +ghost `UiButton`s. HUD, Sonar, 3D, Celestial, Bloom and Sharpen are +pressed toggles with `active` as their pressed class; Detection sets its own +`active` and `panoptic` classes, and Clean UI is not a pressed toggle (its +owner marks it `active`). The panel's Scope, Celestial, +sky, application-row and Reset glyphs are `UiIcon`s with `:size="null"`, so +the panel's rules still size them (`src/ui/kit/visualControls.test.mjs` pins +it). The toggles' other glyphs (◎ ▣ ✈ □ ✨ 🔍) and the presets' style glyphs +are text characters, not Material symbols, and stay plain spans. `UiSelect` renders the bare native select (Core's labels sit outside it or come as an `aria-label`) with `v-model`, `options` and `disabled`; options that carry their own attributes come through the slot, a caller's diff --git a/scripts/format-scope.json b/scripts/format-scope.json index 7dc54bc407..c4c9e5ce3f 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -1343,6 +1343,7 @@ "src/ui/kit/UiDialog.vue", "src/ui/kit/UiDialog.test.mjs", "src/ui/kit/dialogs.test.mjs", + "src/ui/kit/visualControls.test.mjs", "src/ui/styles/chip.css", "src/ui/styles/empty-state.css", "src/ui/rail/RailChips.vue", diff --git a/src/ui/displayPanel.test.mjs b/src/ui/displayPanel.test.mjs index 2928b10487..045d8e9504 100644 --- a/src/ui/displayPanel.test.mjs +++ b/src/ui/displayPanel.test.mjs @@ -72,7 +72,11 @@ function settings(store) { test('before VisualSettings renders, the panel shows its initial markup', (t) => { const { $ } = fixture(t); - assert.equal($('bloom-toggle').className, 'pp-toggle-btn'); + // Beside the kit's ui-* classes, the toggle carries only its own. + assert.deepEqual( + [...$('bloom-toggle').classList].filter((name) => !name.startsWith('ui-')), + ['pp-toggle-btn'], + ); assert.equal($('bloom-slider-row').className, 'pp-slider-row'); assert.equal($('bloom-intensity-slider').value, '0'); assert.equal($('bloom-intensity-value').textContent, '0%'); diff --git a/src/ui/kit/visualControls.test.mjs b/src/ui/kit/visualControls.test.mjs new file mode 100644 index 0000000000..026639fc87 --- /dev/null +++ b/src/ui/kit/visualControls.test.mjs @@ -0,0 +1,53 @@ +// The Visual panel's buttons and Material glyphs are the kit's: neither its +// template nor the presets it renders hand-writes a +
{{ t('Layout') }} @@ -184,7 +185,7 @@ const allocationOptions = computed(() => [
- + {{ t('Scope') }}
@@ -198,21 +199,21 @@ const allocationOptions = computed(() => [ {{ pct(scopeOpacity) }}
- +

{{ t('Effects') }}

- + {{ t('Celestial') }}
- + {{ row.label }}
@@ -225,7 +226,7 @@ const allocationOptions = computed(() => [
- +
{{ pct(view?.bloom.intensity ?? 0) }}
- +
{{ pct(view?.sharpen.intensity ?? 49) }}
- + + {{ t('Reset to default') }} +
From c7df3c67982c0a905796b28328f6f5b218484c1f Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Thu, 19 Nov 2026 15:00:17 +0400 Subject: [PATCH 07/13] 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`. --- changelog.d/1598-f-collapses-data-layers.md | 7 +- docs/CURRENT-STATE.md | 5 +- src/mapSourceFocus.test.mjs | 2 +- src/panelEscape.test.mjs | 2 +- src/ui/panelChrome.js | 57 ++++++--- src/ui/panelChromeButtons.test.mjs | 122 +++++++++++++++++++- src/ui/panelNavigation.js | 7 +- src/ui/panelNavigation.test.mjs | 6 +- src/ui/panelRailCatalog.js | 11 +- 9 files changed, 179 insertions(+), 40 deletions(-) diff --git a/changelog.d/1598-f-collapses-data-layers.md b/changelog.d/1598-f-collapses-data-layers.md index e0f4df4973..42bdc9d833 100644 --- a/changelog.d/1598-f-collapses-data-layers.md +++ b/changelog.d/1598-f-collapses-data-layers.md @@ -1,4 +1,7 @@ - `F` now collapses and reopens the Data Layers panel the way the panel's own button does, and its rail entry stays. Before, `F` hid the panel together - with its rail entry, so only another `F` brought it back (asturksever, - #1598). + with its rail entry, so only another `F` brought it back. When `F` or a + panel's collapse button hides a panel that holds the focus, including one + the opened panel folds away, the focus moves to that panel's rail entry; + in Cockpit, focus in the Contact card it folds moves to the card's expand + button (asturksever, #1598). diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 879c2135fb..f3b2976028 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -3252,7 +3252,10 @@ Browser acceptance: `QA_BASE_URL=http://127.0.0.1:4173 node scripts/qa-segmented `ui/input` supplies the bubbling application shortcut listener and generated shader-parameter rows. Number/style keys, H/O/V/F/D/C actions, native form-control -typing and Escape behavior retain their existing mappings. A shortcut key held +typing and Escape behavior retain their existing mappings. `F` collapses and +reopens Data Layers the way the panel's own collapse button does, so its rail +entry stays; if focus was inside the panel, it moves to that rail entry. +A shortcut key held with Cmd, Ctrl or Alt runs no shortcut, so the browser's own chord (Cmd+C to copy, Cmd+F to find, Cmd+1 to switch tab) does not also toggle CCTV, the layers panel or a style; Shift does not count, and Escape dismisses search either way. diff --git a/src/mapSourceFocus.test.mjs b/src/mapSourceFocus.test.mjs index 22d00f2cf8..a3b24ba23d 100644 --- a/src/mapSourceFocus.test.mjs +++ b/src/mapSourceFocus.test.mjs @@ -110,7 +110,7 @@ function harness({ hidden = false, selected = true, noChips = false } = {}) { window.performance = { now: () => now }; document.defaultView = window; const methods = new Function('createHoverDisclosure', 'collapsePanelOnEscape', 'document', 'window', 'clearTimeout', 'performance', 'requestAnimationFrame', 't', 'msg', 'readPanelState', - `return ({${shellMethod('_initAutoHoverPanel').toString()},\n${shellMethod('_collapsePanelOnEscape').toString()},\n${shellMethod('setPanelCollapsed').toString()},\n${shellMethod('_presentPanel').toString()},\n${shellMethod('_shownPanel').toString()}});`)( + `return ({${shellMethod('_initAutoHoverPanel').toString()},\n${shellMethod('_collapsePanelOnEscape').toString()},\n${shellMethod('_railFocusStand').toString()},\n${shellMethod('setPanelCollapsed').toString()},\n${shellMethod('_presentPanel').toString()},\n${shellMethod('_shownPanel').toString()}});`)( createHoverDisclosure, collapsePanelOnEscape, document, window, (id) => timers.delete(id), { now: () => now }, () => {}, t, msg, readPanelState, ); const saves = []; diff --git a/src/panelEscape.test.mjs b/src/panelEscape.test.mjs index 1177804d01..b3937beb94 100644 --- a/src/panelEscape.test.mjs +++ b/src/panelEscape.test.mjs @@ -42,7 +42,7 @@ function panelFixture({ id = 'data-panel', nested = false, nestedCollapsed = fal disclosure.closest = () => panel; } const document = { getElementById: (candidate) => candidate === id ? panel : null }; - const manager = new Function('document', 'getComputedStyle', 'collapsePanelOnEscape', `return {${method('_collapsePanelOnEscape', '_togglePanel')}};`)(document, (el) => ({ visibility: el.visibility ?? 'visible' }), collapsePanelOnEscape); + const manager = new Function('document', 'getComputedStyle', 'collapsePanelOnEscape', `return {${method('_collapsePanelOnEscape', '_togglePanel')}, ${method('_railFocusStand', '_setCommandDockPanelPinState')}};`)(document, (el) => ({ visibility: el.visibility ?? 'visible' }), collapsePanelOnEscape); manager.setPanelCollapsed = (candidate, value, options) => { assert.equal(candidate, id); assert.equal(value, true); diff --git a/src/ui/panelChrome.js b/src/ui/panelChrome.js index c5da55c43b..bf6e08c3fe 100644 --- a/src/ui/panelChrome.js +++ b/src/ui/panelChrome.js @@ -204,22 +204,7 @@ export class PanelChrome { beforeCollapse: () => { if (panelId === 'location-bar') this._closeLocationSearch?.(); }, - // A desktop side panel hides entirely once collapsed; its rail item - // takes the focus its own disclosure can no longer hold. - returnFocusTo: () => { - const panel = document.getElementById(panelId); - if (!panel?.getClientRects || panel.getClientRects().length > 0) - return null; - const item = document.querySelector?.( - `.ui-rail [data-rail-item="${panelId}"]`, - ); - return item && - !item.disabled && - item.getClientRects().length > 0 && - getComputedStyle(item).visibility === 'visible' - ? item - : null; - }, + returnFocusTo: () => this._railFocusStand(panelId), }); } @@ -228,9 +213,49 @@ export class PanelChrome { if (this._disposed || !this._disclosurePanelIds?.has(panelId)) return; const panel = document.getElementById(panelId); if (!panel) return; + // Opening a panel folds others too (the side accordion, Cockpit's + // Contact card): note which open ones hold the focus. + const focused = document.activeElement; + const holders = [...this._disclosurePanelIds] + .map((id) => document.getElementById(id)) + .filter((el) => el?.contains(focused) && !this._shownPanel(el).collapsed); + const cockpit = this.cockpitView; + const contactHeld = + cockpit?.active && + !cockpit.contextCollapsed && + document.getElementById('cockpit-context')?.contains(focused); this.setPanelCollapsed(panelId, !this._shownPanel(panel).collapsed, { explicit: true, }); + const stand = + contactHeld && cockpit.contextCollapsed + ? document.getElementById('cockpit-context-toggle') + : holders + .filter((el) => this._shownPanel(el).collapsed) + .map((el) => this._railFocusStand(el.id)) + .find(Boolean); + stand?.focus({ preventScroll: true }); + } + + /** + * A desktop side panel hides entirely once collapsed; its rail item takes + * the focus its own disclosure can no longer hold. Null while the panel or + * the item is not shown. + * @param {string} panelId Panel element id. + */ + _railFocusStand(panelId) { + const panel = document.getElementById(panelId); + if (!panel?.getClientRects || panel.getClientRects().length > 0) + return null; + const item = document.querySelector?.( + `.ui-rail [data-rail-item="${panelId}"]`, + ); + return item && + !item.disabled && + item.getClientRects().length > 0 && + getComputedStyle(item).visibility === 'visible' + ? item + : null; } _setCommandDockPanelPinState( diff --git a/src/ui/panelChromeButtons.test.mjs b/src/ui/panelChromeButtons.test.mjs index 75d9e72493..3b0c833fcf 100644 --- a/src/ui/panelChromeButtons.test.mjs +++ b/src/ui/panelChromeButtons.test.mjs @@ -467,8 +467,13 @@ test('the accordion closes peers through the real store, and opens them again', test('F collapses Data Layers like its button and keeps its rail entry', (t) => { document.body.innerHTML = ` +
`; const panel = document.getElementById('data-panel'); + const item = document.querySelector('[data-rail-item="data-panel"]'); + panel.getClientRects = () => + panel.classList.contains('collapsed') ? [] : [{}]; + item.getClientRects = () => [{}]; const store = usePanelChromeStore(createPinia()); const chrome = panelChrome(store); followPanelState(store, 'data-panel', panel); @@ -491,14 +496,16 @@ test('F collapses Data Layers like its button and keeps its rail entry', (t) => chrome.destroy(); }); const press = (init = {}) => - document.body.dispatchEvent( + document.activeElement.dispatchEvent( new KeyboardEvent('keydown', { key: 'f', bubbles: true, ...init }), ); + panel.querySelector('button').focus(); press(); assert.equal(store.panels['data-panel']?.collapsed, true); + assert.ok(document.activeElement === item, 'focus moves to the rail'); assert.ok(panel.classList.contains('collapsed')); - // `active` is what keeps Data Layers in the rail. + // `active` is what shows Data Layers at all (layers.css). assert.ok(panel.classList.contains('active')); press({ metaKey: true }); assert.equal(store.panels['data-panel'].collapsed, true, 'Cmd+F is not ours'); @@ -507,3 +514,114 @@ test('F collapses Data Layers like its button and keeps its rail entry', (t) => assert.ok(!panel.classList.contains('collapsed')); assert.ok(panel.classList.contains('active')); }); + +test('F that folds a focused peer hands the focus to a rail entry', (t) => { + document.body.innerHTML = ` + +
+ +
+
`; + const stack = document.getElementById('left-panel-stack'); + const store = usePanelChromeStore(createPinia()); + const chrome = new PanelChrome({ + elements: { _leftPanelStack: stack }, + operations: { _showToast() {}, _syncCctvPanelViewport() {} }, + readHud: () => ({ visible: false, getVariant: () => null }), + readCockpit: () => null, + readShareLinks: () => null, + readInitialShare: () => null, + readScrollRestoreOwner: () => null, + readDisplayScrollTop: () => 0, + store, + }); + for (const id of ['data-panel', 'pp-toggles']) { + const panel = document.getElementById(id); + panel.getClientRects = () => + panel.classList.contains('collapsed') ? [] : [{}]; + followPanelState(store, id, panel); + } + for (const item of document.querySelectorAll('[data-rail-item]')) + item.getClientRects = () => [{}]; + chrome._disclosurePanelIds = new Set(['data-panel', 'pp-toggles']); + const bindings = new DisplayBindings({ + viewer: null, + services: { isScopeMaskEnabled: () => false, cycleDetectionMode() {} }, + elements: { _locationSearch: document.createElement('input') }, + operations: { + _setScope() {}, + _togglePanel: (panelId) => chrome._togglePanel(panelId), + }, + readState: () => ({}), + claimDetection() {}, + displayStore: useDisplayStore(createPinia()), + }); + bindings._initUI(); + t.after(() => { + bindings.destroy(); + chrome.destroy(); + }); + + const crt2 = document.getElementById('crt2'); + crt2.focus(); + assert.equal(document.activeElement, crt2); + crt2.dispatchEvent(new KeyboardEvent('keydown', { key: 'f', bubbles: true })); + assert.equal( + store.panels['data-panel']?.collapsed, + false, + 'Data Layers opens', + ); + const visual = document.getElementById('pp-toggles'); + assert.ok( + visual.classList.contains('collapsed'), + 'the accordion folds Visual', + ); + assert.ok( + document.activeElement?.matches?.('.ui-rail [data-rail-item]'), + `focus lands on a rail entry, not inside the hidden peer (got ${document.activeElement?.id || document.activeElement?.tagName})`, + ); +}); + +test('opening Data Layers in Cockpit hands the focus from the folded Contact card to its toggle', (t) => { + document.body.innerHTML = ` +
+ +
+ `; + const store = usePanelChromeStore(createPinia()); + const cockpit = { + active: true, + contextCollapsed: false, + setContextCollapsed(collapsed) { + this.contextCollapsed = collapsed; + }, + setSignalCollapsed() {}, + scheduleContextLayout() {}, + }; + const chrome = new PanelChrome({ + elements: { _leftPanelStack: document.getElementById('left-panel-stack') }, + operations: { _showToast() {}, _syncCctvPanelViewport() {} }, + readHud: () => ({ visible: false, getVariant: () => null }), + readCockpit: () => cockpit, + readShareLinks: () => null, + readInitialShare: () => null, + readScrollRestoreOwner: () => null, + readDisplayScrollTop: () => 0, + store, + }); + t.after(() => chrome.destroy()); + followPanelState(store, 'data-panel', document.getElementById('data-panel')); + chrome._disclosurePanelIds = new Set(['data-panel']); + document.getElementById('cockpit-weather-toggle').focus(); + chrome._togglePanel('data-panel'); + assert.equal( + store.panels['data-panel']?.collapsed, + false, + 'Data Layers opens', + ); + assert.equal(cockpit.contextCollapsed, true, 'Contact folds for it'); + assert.equal(document.activeElement?.id, 'cockpit-context-toggle'); +}); diff --git a/src/ui/panelNavigation.js b/src/ui/panelNavigation.js index e6fed5d641..698381a1e8 100644 --- a/src/ui/panelNavigation.js +++ b/src/ui/panelNavigation.js @@ -1,5 +1,5 @@ import PanelRailView from './PanelRailView.vue'; -import { PANEL_RAIL_HOST_CLASS, PANEL_RAIL_ITEMS } from './panelRailCatalog.js'; +import { PANEL_RAIL_HOST_CLASS } from './panelRailCatalog.js'; import { usePanelStore } from './stores/panels.js'; /** @@ -71,7 +71,6 @@ export class PanelNavigation { ? [...stack.children] .filter((panel) => panel.matches('[data-panel-id]')) .map((panel) => { - const shownBy = PANEL_RAIL_ITEMS[panel.id]?.shownBy; return { id: panel.id, title: @@ -79,9 +78,7 @@ export class PanelNavigation { .querySelector('.panel-title, .pp-header-label') ?.textContent.trim() || panel.id, open: !panel.classList.contains('collapsed'), - available: - !panel.hidden && - (!shownBy || panel.classList.contains(shownBy)), + available: !panel.hidden, }; }) : []; diff --git a/src/ui/panelNavigation.test.mjs b/src/ui/panelNavigation.test.mjs index 2eb999d3cc..40b54060da 100644 --- a/src/ui/panelNavigation.test.mjs +++ b/src/ui/panelNavigation.test.mjs @@ -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 = `${title}`; 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']]); diff --git a/src/ui/panelRailCatalog.js b/src/ui/panelRailCatalog.js index 854214a2ad..ead5460ab2 100644 --- a/src/ui/panelRailCatalog.js +++ b/src/ui/panelRailCatalog.js @@ -7,16 +7,11 @@ export const PANEL_RAIL_HOST_CLASS = 'gev-panel-rail'; export const PANEL_RAIL_FALLBACK_ICON = 'more_horiz'; /** - * How each side panel appears on its rail. Labels are the panels' own titles. - * `shownBy` names a class the panel needs to be shown at all (`f` toggles - * Data Layers' `active`). `context` is the label's translation context. + * How each side panel appears on its rail. Labels are the panels' own titles; + * `context` is the label's translation context. */ export const PANEL_RAIL_ITEMS = Object.freeze({ - 'data-panel': { - icon: 'layers', - label: msg('DATA LAYERS'), - shownBy: 'active', - }, + 'data-panel': { icon: 'layers', label: msg('DATA LAYERS') }, 'utilities-panel': { icon: 'handyman', label: msg('UTILITIES') }, 'scene-panel': { icon: 'movie', label: msg('AUTHORING') }, // `context` keeps the panel's name apart from the satellite class of the From bd944ecd0448cab731506c493166058489139b49 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 03:05:09 -0800 Subject: [PATCH 08/13] Vue kit: the entity card's buttons are UiButtons and its glyphs UiIcons The four preview buttons (Photos, Route, 3D, Cockpit view) are pressed toggles with the active class, and Follow is one with its own on class, in place of hand-written aria-pressed. The cockpit entry, Fly to, Ask GEV, the camera preview's bigger-view and More info buttons and the nearby lists' rows are ghost UiButtons. Every Material glyph on the card, in the camera preview and in the nearby lists is a UiIcon sized by the card's own rules. Ask GEV's chat bubble stays inline SVG, since no Material symbol the page loads draws it. A guard test pins it, and the migration notes say so. Co-authored-by: Manjunath Paparaju --- docs/VUE-MIGRATION.md | 9 +++ scripts/format-scope.json | 1 + src/ui/kit/entityCardControls.test.mjs | 84 ++++++++++++++++++++++++++ src/ui/views/panels/CctvPreview.vue | 16 ++--- src/ui/views/panels/EntityCard.vue | 43 +++++++------ src/ui/views/panels/SpotConditions.vue | 38 ++++++------ 6 files changed, 146 insertions(+), 45 deletions(-) create mode 100644 src/ui/kit/entityCardControls.test.mjs diff --git a/docs/VUE-MIGRATION.md b/docs/VUE-MIGRATION.md index a64d55e0c9..30434445d3 100644 --- a/docs/VUE-MIGRATION.md +++ b/docs/VUE-MIGRATION.md @@ -89,6 +89,15 @@ tilt-map button, whose owners still write their state into the DOM. Core's pressable chips and pills (rail card chips, map sources, cities and places) are `UiButton`s too; `UiChip` is a non-interactive label chip, used by the voice card. +The entity card's buttons are ghost `UiButton`s: its four preview buttons +(Photos, Route, 3D, Cockpit view) are pressed toggles with `active`, Follow +is one with `entity-card__action--on`, and the cockpit entry, Fly to and +Ask GEV are plain buttons; so are the camera preview's bigger-view and More +info buttons and the nearby lists' rows (`SpotConditions`, which the +context view shows too). Their glyphs are `UiIcon`s with `:size="null"`, +so entity-card.css and spot-conditions.css still size them +(`src/ui/kit/entityCardControls.test.mjs` pins it). Ask GEV's chat bubble +stays inline SVG, since no Material symbol the page loads draws it. `UiSelect` renders the bare native select (Core's labels sit outside it or come as an `aria-label`) with `v-model`, `options` and `disabled`; options that carry their own attributes come through the slot, a caller's diff --git a/scripts/format-scope.json b/scripts/format-scope.json index 7dc54bc407..c0f72c687c 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -1343,6 +1343,7 @@ "src/ui/kit/UiDialog.vue", "src/ui/kit/UiDialog.test.mjs", "src/ui/kit/dialogs.test.mjs", + "src/ui/kit/entityCardControls.test.mjs", "src/ui/styles/chip.css", "src/ui/styles/empty-state.css", "src/ui/rail/RailChips.vue", diff --git a/src/ui/kit/entityCardControls.test.mjs b/src/ui/kit/entityCardControls.test.mjs new file mode 100644 index 0000000000..5dd3f24587 --- /dev/null +++ b/src/ui/kit/entityCardControls.test.mjs @@ -0,0 +1,84 @@ +// The entity card's buttons and Material glyphs are the kit's: neither its +// template nor the camera preview and nearby lists it renders hand-writes a +// + + +
- + + {{ t('More info') }} + diff --git a/src/ui/views/panels/EntityCard.vue b/src/ui/views/panels/EntityCard.vue index 77ae67c486..fd787d97fc 100644 --- a/src/ui/views/panels/EntityCard.vue +++ b/src/ui/views/panels/EntityCard.vue @@ -10,7 +10,9 @@ import AltitudeGraph from './AltitudeGraph.vue'; import { contextNeedle, contextSearchText, matchesContextSearch } from '../../contextSearch.js'; import RouteGlobe from './RouteGlobe.vue'; import CctvPreview from './CctvPreview.vue'; +import UiButton from '../../kit/UiButton.vue'; import UiCloseButton from '../../kit/UiCloseButton.vue'; +import UiIcon from '../../kit/UiIcon.vue'; import { useCctvStore } from '../../stores/cctv.js'; import SpotConditions from './SpotConditions.vue'; import { shownLayerName } from '../../layerNames.js'; @@ -365,10 +367,10 @@ watch(
- - - - + + + {{ t('3D') }} +
@@ -379,7 +381,7 @@ watch(
- +
{{ factFigure(fact).number }}{{ factFigure(fact).unit }} @@ -391,7 +393,7 @@ watch(
- +
{{ kindLine }}

{{ shownTitle }}

@@ -406,14 +408,14 @@ watch(
{{ card.route.from }} {{ card.route.to }}
@@ -435,7 +437,7 @@ watch( class="entity-card__route-note" :title="t('The scheduled route for this flight number does not match where the plane is; it may be another leg of the same flight.')" > - {{ t('Scheduled · unverified: does not match where the plane is') }} + {{ t('Scheduled · unverified: does not match where the plane is') }}

@@ -462,20 +464,21 @@ watch(
- + + {{ card.layerId === 'satellites' ? t('Enter orbital view') : t('Enter Cockpit') }} +
- - + + {{ t('Fly to') }} + + + {{ store.isFollowing() ? t('Following') : t('Follow') }} +
- +
diff --git a/src/ui/views/panels/SpotConditions.vue b/src/ui/views/panels/SpotConditions.vue index 225279625c..9b2b92dce8 100644 --- a/src/ui/views/panels/SpotConditions.vue +++ b/src/ui/views/panels/SpotConditions.vue @@ -5,6 +5,8 @@ import { compassName, hazardsNear, regionalBrief, weatherLook } from '../../spot import { distanceKm } from '../../../data/entityContext.js'; import { CONTEXT_RADIUS_STEPS, contextRadiusKm, setContextRadiusKm } from '../../contextRadius.js'; import { contextNeedle, matchesContextSearch } from '../../contextSearch.js'; +import UiButton from '../../kit/UiButton.vue'; +import UiIcon from '../../kit/UiIcon.vue'; import UiSlider from '../../kit/UiSlider.js'; import { sayWords, useEntityCardStore } from '../../stores/entityCard.js'; import { useOmnibarStore } from '../../stores/omnibar.js'; @@ -265,7 +267,7 @@ const sources = computed(() => {