From 28ee3bfc3748c60af1dba027a655fe344b1ea168 Mon Sep 17 00:00:00 2001 From: Said Turksever Date: Fri, 6 Nov 2026 00:47:52 +0000 Subject: [PATCH 01/42] 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/42] 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/42] 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/42] 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 0b06bc664598e11487d9865b6742402726a95982 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 01:39:13 -0800 Subject: [PATCH 05/42] Vue: the credits line and its Data attribution list are a single-file component mountCreditsView() keeps its signature and stays the owner: it computes the credits shown once each, keeps the list's open state and its focus, takes the expand and close clicks and Escape, and renders CreditsView synchronously (as the weather readout is rendered), so focus moves as soon as a change returns. The view teleports the line and the list to the end of the body, as the script appended them, so the page's rules that select them as children of the body still apply; CreditItem draws one credit (its logo or its text, only its linked words linked, links and logos kept only for a safe scheme). The ids, classes, roles, aria attributes and text are unchanged. The list's close button is a UiCloseButton with bare, keeping the browser's padding, so it only gains the kit's classes, which carry no rules. The expand button stays a plain button: its words are its content, which a UiButton slot would not word again when the owner renders a new locale. The list's items are keyed by credit, so a link that keeps its place keeps focus through a redraw; one that goes still hands focus to the close button. New tests: the line and list follow the locale, and they are the last of the body with the kit's close button. Co-authored-by: Manjunath Paparaju --- docs/VUE-MIGRATION.md | 20 +++- scripts/format-scope.json | 2 + scripts/package-boundaries.json | 2 + src/ui/credits/CreditItem.vue | 53 ++++++++++ src/ui/credits/CreditsView.vue | 82 +++++++++++++++ src/ui/creditsView.js | 177 ++++++++++---------------------- src/ui/creditsView.test.mjs | 57 +++++++++- 7 files changed, 267 insertions(+), 126 deletions(-) create mode 100644 src/ui/credits/CreditItem.vue create mode 100644 src/ui/credits/CreditsView.vue diff --git a/docs/VUE-MIGRATION.md b/docs/VUE-MIGRATION.md index 5d5f0c0b63..a085534fa2 100644 --- a/docs/VUE-MIGRATION.md +++ b/docs/VUE-MIGRATION.md @@ -108,8 +108,9 @@ no tip unless the site passes a `title`; attributes and classes pass through, so each site keeps its id, feature class and look. Every close, dismiss and clear button in the views is one (`src/ui/kit/closeButtons.test.mjs` pins it); Street Level's and the space mission's keep `bare`, since their skins -keep the browser's padding. The close buttons built in script (credits, the -Quebec CCTV overlay, the guide) are not converted yet. +keep the browser's padding, and so does the credits list's. The close +buttons built in script (the Quebec CCTV overlay, the guide) are not +converted yet. `UiSearchField` takes `v-model`, a required `label` (the input's accessible name), `placeholder` and `tag` (`div`, given `role="search"` by the site, or `label`); attributes and classes go to the frame, and @@ -177,6 +178,12 @@ page declares no dark `color-scheme`. Selects and number fields are and keeps native spinners dark; ranges are `.gev-quantitative-slider`, with a feature supplying only its accent. +`t()` is not reactive. Words a view passes to a kit component as a prop +(`UiCloseButton`'s `label`) follow a locale change on the view's next +render, but words in a kit component's slot do not: the compiled slot does +not render the child again. A view whose words must follow the locale at +once passes the locale itself as a prop or key, as the credits line does. + ## Phases 1. **Foundation.** Vue, Pinia and the Vite Vue plugin join the browser build @@ -368,7 +375,14 @@ a feature supplying only its accent. choices, DISMISS and "Don't show this again" call the launcher's controls; a refused save hands the tick back to the view to revert. The launcher still reads the rendered card for its hit test, keyboard trap, - focus and overflow measurement), then + focus and overflow measurement), the attribution line (for a renderer + without its own credit display, `mountCreditsView()` renders + `CreditsView` synchronously, as the weather readout is, and the view + teleports the line and its "Data attribution" list to the end of the + body, where the page's rules select them; the owner keeps the credits + shown, the list's open state and its focus, and words the view again + when the locale changes; the list's close button is a bare + `UiCloseButton`), then Cockpit (in progress: `CockpitBriefing` renders the briefing card's pages, cycle toggle, regional news and local conditions, and `CockpitContext` the Contact card's scope, navigation, counts, nearest diff --git a/scripts/format-scope.json b/scripts/format-scope.json index 76004da995..7dc54bc407 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -1585,6 +1585,8 @@ "src/ui/creditLineHeight.js", "src/ui/creditLineHeight.test.mjs", "src/ui/creditsView.test.mjs", + "src/ui/credits/CreditsView.vue", + "src/ui/credits/CreditItem.vue", "src/cockpitSubjectProviders.js", "src/cockpitSubjectProviders.test.mjs", "src/cockpitProgress.js", diff --git a/scripts/package-boundaries.json b/scripts/package-boundaries.json index caf06537ef..20e9c6de8f 100644 --- a/scripts/package-boundaries.json +++ b/scripts/package-boundaries.json @@ -5488,6 +5488,8 @@ "src/render/cesium/viewers.js", "src/ui/creditLineHeight.js", "src/ui/creditsView.js", + "src/ui/credits/CreditsView.vue", + "src/ui/credits/CreditItem.vue", "src/data/planespottersPhoto.js", "src/maps/keylessTerrain.js", "src/render/cesium/vectorBase.js", diff --git a/src/ui/credits/CreditItem.vue b/src/ui/credits/CreditItem.vue new file mode 100644 index 0000000000..fd3f95478c --- /dev/null +++ b/src/ui/credits/CreditItem.vue @@ -0,0 +1,53 @@ + + + diff --git a/src/ui/credits/CreditsView.vue b/src/ui/credits/CreditsView.vue new file mode 100644 index 0000000000..4181af2995 --- /dev/null +++ b/src/ui/credits/CreditsView.vue @@ -0,0 +1,82 @@ + + + diff --git a/src/ui/creditsView.js b/src/ui/creditsView.js index 03acd1358d..738d116161 100644 --- a/src/ui/creditsView.js +++ b/src/ui/creditsView.js @@ -6,16 +6,14 @@ * credits). Inline credits are shown on the line at the bottom left; the * rest are in the "Data attribution" list it opens. A credit is plain data * (`src/render/contract/credits.d.ts`): its text is set as text, and a link - * or logo is kept only for a safe scheme. + * or logo is kept only for a safe scheme. `CreditsView` renders the line and + * the list; this owner keeps the credits shown, the list's open state and + * its focus. */ +import { h, render as renderVue } from 'vue'; import { findCredits } from '../render/rendererOf.js'; -import { - LINK_SCHEMES, - LOGO_SCHEMES, - safeUrl, - splitLink, -} from '../render/creditMarkup.js'; -import { onLocaleChange, t } from '../i18n/index.js'; +import { getLocale, onLocaleChange } from '../i18n/index.js'; +import CreditsView from './credits/CreditsView.vue'; const PANEL_ID = 'gev-credits-panel'; @@ -30,42 +28,6 @@ function distinct(list) { }); } -/** One credit as DOM: its logo or its text, linked when it has a link. */ -function creditElement(doc, credit) { - const href = credit.href ? safeUrl(credit.href, LINK_SCHEMES) : null; - const logoUrl = credit.logoUrl ? safeUrl(credit.logoUrl, LOGO_SCHEMES) : null; - // Only the credit's linked words are the link, as the source wrote it. - if (href && !logoUrl && credit.linkText) { - const [before, words, after] = splitLink(credit); - const element = doc.createElement('span'); - element.className = 'gev-credit'; - const link = doc.createElement('a'); - link.href = href; - link.target = '_blank'; - link.rel = 'noopener noreferrer'; - link.textContent = words; - element.append(before, link, after); - return element; - } - const element = doc.createElement(href ? 'a' : 'span'); - element.className = 'gev-credit'; - if (href) { - element.href = href; - element.target = '_blank'; - element.rel = 'noopener noreferrer'; - } - // A logo is drawn in place of the text, which names it (its alt text). - const logo = credit.logoUrl ? safeUrl(credit.logoUrl, LOGO_SCHEMES) : null; - if (logo) { - const image = doc.createElement('img'); - image.className = 'gev-credit-logo'; - image.src = logo; - image.alt = credit.text; - element.append(image); - } else element.textContent = credit.text; - return element; -} - /** * Show `viewer`'s renderer credits at the bottom left of `root`'s page. * @param {object} viewer The scene object, bound to its renderer. @@ -76,106 +38,77 @@ export function mountCreditsView(viewer, { root = document.body } = {}) { const credits = findCredits(viewer); if (!credits || !root) return () => {}; const doc = root.ownerDocument; - const bar = doc.createElement('div'); - bar.id = 'gev-credits'; - bar.className = 'gev-credits'; - // Takes focus back from an emptied list when the line has no link. - bar.tabIndex = -1; - const line = doc.createElement('span'); - line.className = 'gev-credits-line'; - const expand = doc.createElement('button'); - expand.type = 'button'; - expand.className = 'gev-credits-expand'; - expand.setAttribute('aria-haspopup', 'dialog'); - expand.setAttribute('aria-controls', PANEL_ID); - expand.setAttribute('aria-expanded', 'false'); + // The view teleports the line and the list to the end of `root`; this + // host, never in the page, holds only its place. + const host = doc.createElement('div'); + const elements = {}; + let inline = []; + let listed = []; + let open = false; - const panel = doc.createElement('div'); - panel.id = PANEL_ID; - panel.className = 'gev-credits-panel'; - panel.setAttribute('role', 'dialog'); - panel.hidden = true; - const header = doc.createElement('div'); - header.className = 'gev-credits-header'; - const title = doc.createElement('span'); - title.className = 'gev-credits-title'; - title.id = `${PANEL_ID}-title`; - panel.setAttribute('aria-labelledby', title.id); - const close = doc.createElement('button'); - close.type = 'button'; - close.className = 'gev-credits-close'; - close.textContent = '×'; - header.append(title, close); - const list = doc.createElement('ul'); - list.className = 'gev-credits-list'; - panel.append(header, list); - bar.append(line, expand); - root.append(bar, panel); + // The view patches synchronously, so focus can move once it returns. + const paint = () => + renderVue( + h(CreditsView, { + to: root, + panelId: PANEL_ID, + inline, + listed, + open, + locale: getLocale(), + elements, + onExpand, + onClose, + onKeydown, + }), + host, + ); - const label = () => { - expand.textContent = t('Data attribution'); - title.textContent = t('Data provided by:'); - close.setAttribute('aria-label', t('Close data attribution')); - }; - - const setOpen = (open, { focus = false } = {}) => { - panel.hidden = !open; - expand.setAttribute('aria-expanded', String(open)); - if (open) close.focus(); - else if (focus) expand.focus(); + const setOpen = (next, { focus = false } = {}) => { + open = next; + paint(); + if (open) elements.close.focus(); + else if (focus) elements.expand.focus(); }; const render = (all) => { + const { bar, line, panel } = elements; const focused = panel.contains(doc.activeElement); const shown = distinct(Array.isArray(all) ? all : []); - const inline = shown.filter((credit) => credit.inline); - const listed = shown.filter((credit) => !credit.inline); - line.replaceChildren(); - inline.forEach((credit, i) => { - if (i) line.append(doc.createTextNode(' · ')); - line.append(creditElement(doc, credit)); - }); - if (inline.length && listed.length) line.append(doc.createTextNode(' · ')); - list.replaceChildren( - ...listed.map((credit) => { - const item = doc.createElement('li'); - item.append(creditElement(doc, credit)); - return item; - }), - ); - expand.hidden = listed.length === 0; - if (expand.hidden && !panel.hidden) { + inline = shown.filter((credit) => credit.inline); + listed = shown.filter((credit) => !credit.inline); + paint(); + if (listed.length === 0 && open) { // Focus in the list goes back to the line, not to the page. setOpen(false); if (focused) (line.querySelector('a') ?? bar).focus(); } else if (focused && !panel.contains(doc.activeElement)) { // A link that focus was on was redrawn: focus stays in the list. - close.focus(); + elements.close.focus(); } }; - const onExpand = () => setOpen(panel.hidden); - const onClose = () => setOpen(false, { focus: true }); + function onExpand() { + setOpen(!open); + } + function onClose() { + setOpen(false, { focus: true }); + } // Escape in the open list closes it (it takes focus as it opens). - const onKey = (event) => { - if (event.key !== 'Escape' || panel.hidden) return; + function onKeydown(event) { + if (event.key !== 'Escape' || !open) return; event.preventDefault(); setOpen(false, { focus: true }); - }; - expand.addEventListener('click', onExpand); - close.addEventListener('click', onClose); - panel.addEventListener('keydown', onKey); - label(); + } + + paint(); render(credits.list()); const offChange = credits.on('change', render); - const offLocale = onLocaleChange(label); + // The view words its text again in the new locale, as it renders. + const offLocale = onLocaleChange(paint); return () => { offChange(); offLocale(); - expand.removeEventListener('click', onExpand); - close.removeEventListener('click', onClose); - panel.removeEventListener('keydown', onKey); - bar.remove(); - panel.remove(); + renderVue(null, host); }; } diff --git a/src/ui/creditsView.test.mjs b/src/ui/creditsView.test.mjs index 17e443b52b..34a66b4255 100644 --- a/src/ui/creditsView.test.mjs +++ b/src/ui/creditsView.test.mjs @@ -4,6 +4,7 @@ import assert from 'node:assert/strict'; import { mountCreditsView } from './creditsView.js'; import { bindRenderer } from '../render/rendererOf.js'; import { createStubRenderer } from '../render/stub/index.js'; +import { setLocale } from '../i18n/index.js'; function scene() { document.body.replaceChildren(); @@ -118,10 +119,12 @@ test('focus in the list stays in it as it redraws, and goes to the line as it em const off = mountCreditsView(viewer); const panel = document.getElementById('gev-credits-panel'); document.querySelector('.gev-credits-expand').click(); - panel.querySelector('li a').focus(); + const link = panel.querySelector('li a'); + link.focus(); const removeOther = renderer.credits.addStatic({ text: 'NOAA' }); assert.equal(panel.hidden, false); assert.ok(panel.contains(document.activeElement), 'still in the list'); + assert.equal(document.activeElement, link, 'the focused link keeps it'); remove(); removeOther(); assert.equal(panel.hidden, true); @@ -152,3 +155,55 @@ test('a credit with linked words links only those words', () => { ); off(); }); + +test('the line and its list follow the locale', () => { + const { viewer, renderer } = scene(); + renderer.credits.addStatic({ text: 'NOAA' }); + const off = mountCreditsView(viewer); + const expand = document.querySelector('.gev-credits-expand'); + const close = document.querySelector('.gev-credits-close'); + try { + setLocale('fr'); + assert.equal(expand.textContent, 'Attribution des données'); + assert.equal( + document.getElementById('gev-credits-panel-title').textContent, + 'Données fournies par\u202f:', + ); + assert.equal( + close.getAttribute('aria-label'), + "Fermer l'attribution des données", + ); + } finally { + setLocale('en'); + } + assert.equal(expand.textContent, 'Data attribution'); + off(); +}); + +test('the line and its list are the last of the body, and its close button is the kit’s', () => { + const { viewer, renderer } = scene(); + document.body.append(document.createElement('main')); + renderer.credits.addStatic({ text: 'NOAA' }); + const off = mountCreditsView(viewer); + const children = [...document.body.children]; + assert.deepEqual( + children.slice(-2).map((element) => element.id), + ['gev-credits', 'gev-credits-panel'], + 'the page’s rules select them as children of the body', + ); + const close = document.querySelector('.gev-credits-close'); + assert.ok(close.classList.contains('ui-button'), 'a UiCloseButton'); + assert.equal(close.type, 'button'); + assert.equal(close.textContent, '×'); + assert.equal(close.hasAttribute('title'), false, 'no tip'); + assert.equal( + close.classList.contains('ui-close-button'), + false, + 'bare: it keeps the browser’s padding', + ); + off(); + assert.deepEqual( + [...document.body.children].map((element) => element.tagName), + ['MAIN'], + ); +}); From 121d11d3ff92671a14844d4cbc302bbc2f688528 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 01:43:57 -0800 Subject: [PATCH 06/42] Vue: the Quebec CCTV overlay is a single-file component MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QuebecCctvOverlay renders the Québec 511 player window and its map preview, teleported to the end of the body as before, with the kit's UiCloseButton and UiButtons. createQuebecCctvOverlay() keeps its API and every decision: it renders the view synchronously from the state it computes on each change, and keeps the parts the template never binds (each video's source, playback and refresh timer, the window's drag, and the marker's per-frame visibility and place). The markup is unchanged apart from the kit's button classes. The overlay test renders in the registered document, which Vue binds when it loads, and adds Escape closing the window until the camera is picked again. Co-authored-by: Manjunath Paparaju --- docs/VUE-MIGRATION.md | 13 +- scripts/package-boundaries.json | 7 + src/ui/quebecCctvOverlay.js | 296 ++++++++++------------ src/ui/quebecCctvOverlay.test.mjs | 60 +++-- src/ui/views/panels/QuebecCctvOverlay.vue | 110 ++++++++ 5 files changed, 302 insertions(+), 184 deletions(-) create mode 100644 src/ui/views/panels/QuebecCctvOverlay.vue diff --git a/docs/VUE-MIGRATION.md b/docs/VUE-MIGRATION.md index 5d5f0c0b63..8cdeb68781 100644 --- a/docs/VUE-MIGRATION.md +++ b/docs/VUE-MIGRATION.md @@ -108,8 +108,8 @@ no tip unless the site passes a `title`; attributes and classes pass through, so each site keeps its id, feature class and look. Every close, dismiss and clear button in the views is one (`src/ui/kit/closeButtons.test.mjs` pins it); Street Level's and the space mission's keep `bare`, since their skins -keep the browser's padding. The close buttons built in script (credits, the -Quebec CCTV overlay, the guide) are not converted yet. +keep the browser's padding. The close buttons built in script (credits and +the guide) are not converted yet. `UiSearchField` takes `v-model`, a required `label` (the input's accessible name), `placeholder` and `tag` (`div`, given `role="search"` by the site, or `label`); attributes and classes go to the frame, and @@ -244,8 +244,13 @@ a feature supplying only its accent. the whole panel from the `gev-cctv` store, including the camera picker, the inline pose editor, the frame preview, source badge and typed summary; `CctvControls` keeps its listeners, the frame requests and the - live video surface), Layers (done: `LayerPanel` presents each row and - renders `LayerRows` synchronously; keyed chips and list items keep focus + live video surface; `QuebecCctvOverlay` teleports the Québec 511 player + and its map preview to the end of the body, rendered synchronously by + `createQuebecCctvOverlay()` from the view it computes, as the rail cards + are; the owner keeps every decision and the parts the template never + binds: each video's source, playback and refresh timer, the window's drag + and the marker's per-frame visibility and place), Layers (done: + `LayerPanel` presents each row and renders `LayerRows` synchronously; keyed chips and list items keep focus through the refresh their own click triggers, and clicks re-read the live descriptor before acting), Display (in progress: `DisplayPanel` renders the HUD, Sonar, Scope, Celestial, detection, bloom, sharpen and the diff --git a/scripts/package-boundaries.json b/scripts/package-boundaries.json index caf06537ef..2367606ddb 100644 --- a/scripts/package-boundaries.json +++ b/scripts/package-boundaries.json @@ -1096,6 +1096,11 @@ "src/ui/cctvVideo.js", "src/ui/cctvPresentation.js", "src/ui/quebecCctvOverlay.js", + "src/ui/views/panels/QuebecCctvOverlay.vue", + "src/ui/kit/UiButton.vue", + "src/ui/kit/UiCloseButton.vue", + "src/ui/kit/UiIcon.vue", + "src/ui/rail/classToggle.js", "src/i18n/index.js", "src/i18n/locale.js", "src/i18n/locales/ar.json", @@ -1635,6 +1640,7 @@ "src/layers/wildlifeSightings/photoText.js", "src/data/iconOrientation.js", "src/ui/quebecCctvOverlay.js", + "src/ui/views/panels/QuebecCctvOverlay.vue", "src/time/worldClock.js", "src/cockpitSubjects.js", "src/cockpitRadar.js", @@ -5459,6 +5465,7 @@ "src/layers/wildlifeSightings/iconCollection.js", "src/layers/wildlifeSightings/view.js", "src/ui/quebecCctvOverlay.js", + "src/ui/views/panels/QuebecCctvOverlay.vue", "src/time/viewerClock.js", "src/time/worldClock.js", "src/cockpitSubjects.js", diff --git a/src/ui/quebecCctvOverlay.js b/src/ui/quebecCctvOverlay.js index 2416aca945..0cf3e0a61e 100644 --- a/src/ui/quebecCctvOverlay.js +++ b/src/ui/quebecCctvOverlay.js @@ -1,3 +1,4 @@ +import { h, render as renderVue } from 'vue'; import { fromDegrees } from '../geo/ellipsoid.js'; import { horizonFrom } from '../geo/horizon.js'; import { distance } from '../geo/vector.js'; @@ -8,6 +9,7 @@ import { findQuery, } from '../render/rendererOf.js'; import { t } from '../i18n/index.js'; +import QuebecCctvOverlay from './views/panels/QuebecCctvOverlay.vue'; function isQuebecCamera(camera) { return String(camera?.sourceKind || '').startsWith('quebec-'); @@ -77,72 +79,77 @@ function mediaRefreshUrl(value) { * Attach the active Québec source to a floating browser player and map * preview. The browser contacts Québec 511 only after the viewer presses Play * for that camera; selecting it (by click, auto-hop, a scene or voice) only - * shows its details and the play control. + * shows its details and the play control. The panel and marker are the + * `QuebecCctvOverlay` view, rendered synchronously on each change. */ export function createQuebecCctvOverlay(viewer) { if (!viewer || typeof document === 'undefined') return null; const controller = new AbortController(); const { signal } = controller; - const panel = document.createElement('section'); - panel.className = 'qci-panel'; - panel.hidden = true; - panel.setAttribute('role', 'region'); - panel.setAttribute('aria-label', t('CCTV camera')); - - const header = document.createElement('header'); - header.className = 'qci-header'; - const title = document.createElement('strong'); - const close = document.createElement('button'); - close.type = 'button'; - close.textContent = '×'; - close.setAttribute('aria-label', t('Close camera preview')); - header.append(title, close); - - const coordinates = document.createElement('p'); - coordinates.className = 'qci-coordinates'; - const credit = document.createElement('p'); - credit.className = 'qci-credit'; - const live = document.createElement('video'); - live.className = 'qci-live'; - live.controls = true; - live.muted = true; - live.autoplay = true; - live.loop = true; - live.playsInline = true; - live.setAttribute('aria-label', t('CCTV camera')); - - const actions = document.createElement('div'); - actions.className = 'qci-actions'; - const play = document.createElement('button'); - play.type = 'button'; - play.className = 'qci-play'; - play.textContent = t('Play'); - const refresh = document.createElement('button'); - refresh.type = 'button'; - refresh.textContent = t('Refresh map still'); - actions.append(play, refresh); - const note = document.createElement('p'); - note.className = 'qci-note'; - const sourceLink = document.createElement('a'); - sourceLink.target = '_blank'; - sourceLink.rel = 'noopener noreferrer'; - sourceLink.textContent = t("Open this image on the provider's site"); - panel.append(header, coordinates, credit, live, actions, note, sourceLink); - - const marker = document.createElement('div'); - marker.className = 'qci-marker'; - marker.hidden = true; - const still = document.createElement('video'); - still.className = 'qci-marker-still'; - still.muted = true; - still.playsInline = true; - still.preload = 'none'; - still.setAttribute('aria-hidden', 'true'); - const markerLabel = document.createElement('span'); - markerLabel.className = 'qci-marker-label'; - marker.append(still, markerLabel); - document.body.append(panel, marker); + // What the view renders. The owner writes it where it used to write the + // elements, then paints; the view never binds the media sources, the + // panel's dragged position or the marker's per-frame visibility and place. + const view = { + panelHidden: true, + title: '', + coordinates: '', + credit: '', + creditHidden: false, + liveHidden: false, + actionsHidden: false, + playHidden: false, + refreshHidden: false, + note: '', + noteHidden: false, + sourceHref: null, + sourceHidden: false, + markerLinkOnly: false, + stillHidden: false, + markerLabel: '', + }; + const host = document.createElement('div'); + let disposed = false; + const handlers = { + onClose: closeWindow, + onPlay: startPlayback, + onRefresh: refreshStill, + onKeydown(event) { + if (event.key === 'Escape') close.click(); + }, + onHeaderPointerdown: startDrag, + onLiveError: markLiveUnavailable, + onLiveLoadeddata() { + liveUnavailable = false; + view.note = t( + 'The map still uses a separate request and may show a different moment.', + ); + view.noteHidden = false; + paint(); + }, + onStillError: markStillUnavailable, + onStillLoadeddata() { + stillUnavailable = false; + if (selected) + view.markerLabel = markerLabelText(selected, Boolean(selectedMediaUrl)); + paint(); + still.pause(); + }, + }; + /** Render the view now: the panel and marker go to the end of the body. */ + function paint() { + if (disposed) return null; + const vnode = h(QuebecCctvOverlay, { view: { ...view }, ...handlers }); + renderVue(vnode, host); + return vnode.component.exposed; + } + const elements = paint(); + const panel = elements.panel.value; + const header = elements.header.value; + const close = elements.close.value.$el; + const live = elements.live.value; + const marker = elements.marker.value; + const still = elements.still.value; let selected = null; let selectedPosition = null; @@ -166,13 +173,15 @@ export function createQuebecCctvOverlay(viewer) { function markLiveUnavailable() { liveUnavailable = true; - note.textContent = t('Source unavailable'); - note.hidden = false; + view.note = t('Source unavailable'); + view.noteHidden = false; + paint(); } function markStillUnavailable() { stillUnavailable = true; - markerLabel.textContent = t('Source unavailable'); + view.markerLabel = t('Source unavailable'); + paint(); } function startRender() { @@ -218,16 +227,17 @@ export function createQuebecCctvOverlay(viewer) { playingCameraId = selected.id; liveUnavailable = false; stillUnavailable = false; - play.hidden = true; - refresh.hidden = false; - live.hidden = false; - still.hidden = false; - marker.classList.remove('qci-marker-link-only'); - note.textContent = t( + view.playHidden = true; + view.refreshHidden = false; + view.liveHidden = false; + view.stillHidden = false; + view.markerLinkOnly = false; + view.note = t( 'The map still uses a separate request and may show a different moment.', ); - note.hidden = false; - markerLabel.textContent = markerLabelText(selected, true); + view.noteHidden = false; + view.markerLabel = markerLabelText(selected, true); + paint(); setMedia(live, selectedMediaUrl); setMedia(still, selectedMediaUrl); void live.play().catch(onPlayFailure(markLiveUnavailable)); @@ -246,7 +256,8 @@ export function createQuebecCctvOverlay(viewer) { stillUnavailable = false; stopMediaRefresh(); stopRender(); - panel.hidden = true; + view.panelHidden = true; + paint(); marker.hidden = true; setMedia(live, ''); setMedia(still, ''); @@ -263,7 +274,8 @@ export function createQuebecCctvOverlay(viewer) { Number(camera.elevationM) || 10, ); if (closedWindowCameraId === camera.id && !reselected) { - panel.hidden = true; + view.panelHidden = true; + paint(); updateMarker(); return; } @@ -276,8 +288,8 @@ export function createQuebecCctvOverlay(viewer) { playingCameraId = null; } const playing = Boolean(mediaUrl) && playingCameraId === camera.id; - title.textContent = camera.name || t('CCTV camera'); - coordinates.textContent = [ + view.title = camera.name || t('CCTV camera'); + view.coordinates = [ `${Number(camera.lat).toFixed(5)}, ${Number(camera.lon).toFixed(5)}`, Number.isFinite(camera.accuracyM) && camera.accuracyM > 0 ? `±${Math.round(camera.accuracyM)} m` @@ -286,14 +298,13 @@ export function createQuebecCctvOverlay(viewer) { ] .filter(Boolean) .join(' · '); - credit.textContent = camera.credit || camera.provider || ''; - credit.hidden = !credit.textContent; - live.hidden = !playing; - play.hidden = !mediaUrl || playing; - refresh.hidden = !playing; - actions.hidden = !mediaUrl; - note.hidden = !mediaUrl; - note.textContent = mediaUrl + view.credit = camera.credit || camera.provider || ''; + view.creditHidden = !view.credit; + view.liveHidden = !playing; + view.playHidden = !mediaUrl || playing; + view.refreshHidden = !playing; + view.actionsHidden = !mediaUrl; + view.note = mediaUrl ? !playing ? t('Video plays from Québec 511, which sees your IP address.') : liveUnavailable @@ -304,15 +315,16 @@ export function createQuebecCctvOverlay(viewer) { : sourceUrl ? '' : t('Source unavailable'); - note.hidden = !note.textContent; - sourceLink.href = sourceUrl || '#'; - sourceLink.hidden = !sourceUrl; - markerLabel.textContent = stillUnavailable + view.noteHidden = !view.note; + view.sourceHref = sourceUrl || '#'; + view.sourceHidden = !sourceUrl; + view.markerLabel = stillUnavailable ? t('Source unavailable') : markerLabelText(camera, playing); - marker.classList.toggle('qci-marker-link-only', !playing); - still.hidden = !playing; - panel.hidden = false; + view.markerLinkOnly = !playing; + view.stillHidden = !playing; + view.panelHidden = false; + paint(); if (changed || mediaUrl !== selectedMediaUrl) { selectedMediaUrl = mediaUrl; @@ -366,34 +378,6 @@ export function createQuebecCctvOverlay(viewer) { ); } - still.addEventListener( - 'loadeddata', - () => { - stillUnavailable = false; - if (selected) - markerLabel.textContent = markerLabelText( - selected, - Boolean(selectedMediaUrl), - ); - still.pause(); - }, - { signal }, - ); - still.addEventListener('error', markStillUnavailable, { signal }); - live.addEventListener('error', markLiveUnavailable, { signal }); - live.addEventListener( - 'loadeddata', - () => { - liveUnavailable = false; - note.textContent = t( - 'The map still uses a separate request and may show a different moment.', - ); - note.hidden = false; - }, - { signal }, - ); - refresh.addEventListener('click', refreshStill, { signal }); - play.addEventListener('click', startPlayback, { signal }); const resetCanvasRect = () => { canvasRect = null; }; @@ -403,49 +387,35 @@ export function createQuebecCctvOverlay(viewer) { capture: true, passive: true, }); - panel.addEventListener( - 'keydown', - (event) => { - if (event.key === 'Escape') close.click(); - }, - { signal }, - ); - close.addEventListener( - 'click', - () => { - closedWindowCameraId = selected?.id || null; - panel.hidden = true; - live.pause(); - stopMediaRefresh(); - // The floating player closes independently; keep the paused map still. - updateMarker(); - }, - { signal }, - ); - header.addEventListener( - 'pointerdown', - (event) => { - if (event.target.closest('button')) return; - const rect = panel.getBoundingClientRect(); - const offsetX = event.clientX - rect.left; - const offsetY = event.clientY - rect.top; - header.setPointerCapture(event.pointerId); - const move = (moveEvent) => { - panel.style.left = `${Math.max(0, Math.min(window.innerWidth - panel.offsetWidth, moveEvent.clientX - offsetX))}px`; - panel.style.top = `${Math.max(0, Math.min(window.innerHeight - panel.offsetHeight, moveEvent.clientY - offsetY))}px`; - panel.style.right = 'auto'; - }; - const stop = () => { - header.removeEventListener('pointermove', move); - header.removeEventListener('pointerup', stop); - header.removeEventListener('pointercancel', stop); - }; - header.addEventListener('pointermove', move, { signal }); - header.addEventListener('pointerup', stop, { once: true, signal }); - header.addEventListener('pointercancel', stop, { once: true, signal }); - }, - { signal }, - ); + function closeWindow() { + closedWindowCameraId = selected?.id || null; + view.panelHidden = true; + paint(); + live.pause(); + stopMediaRefresh(); + // The floating player closes independently; keep the paused map still. + updateMarker(); + } + function startDrag(event) { + if (event.target.closest('button')) return; + const rect = panel.getBoundingClientRect(); + const offsetX = event.clientX - rect.left; + const offsetY = event.clientY - rect.top; + header.setPointerCapture(event.pointerId); + const move = (moveEvent) => { + panel.style.left = `${Math.max(0, Math.min(window.innerWidth - panel.offsetWidth, moveEvent.clientX - offsetX))}px`; + panel.style.top = `${Math.max(0, Math.min(window.innerHeight - panel.offsetHeight, moveEvent.clientY - offsetY))}px`; + panel.style.right = 'auto'; + }; + const stop = () => { + header.removeEventListener('pointermove', move); + header.removeEventListener('pointerup', stop); + header.removeEventListener('pointercancel', stop); + }; + header.addEventListener('pointermove', move, { signal }); + header.addEventListener('pointerup', stop, { once: true, signal }); + header.addEventListener('pointercancel', stop, { once: true, signal }); + } document.addEventListener( 'visibilitychange', () => { @@ -469,8 +439,8 @@ export function createQuebecCctvOverlay(viewer) { stopRender(); setMedia(live, ''); setMedia(still, ''); - panel.remove(); - marker.remove(); + disposed = true; + renderVue(null, host); selected = null; selectedPosition = null; }, diff --git a/src/ui/quebecCctvOverlay.test.mjs b/src/ui/quebecCctvOverlay.test.mjs index ca8a04934a..386dd7547a 100644 --- a/src/ui/quebecCctvOverlay.test.mjs +++ b/src/ui/quebecCctvOverlay.test.mjs @@ -1,6 +1,6 @@ +import '../testSupport/registerDom.mjs'; import { test } from 'node:test'; import assert from 'node:assert/strict'; -import { Window } from 'happy-dom'; import { fromDegrees } from '../geo/ellipsoid.js'; import { bindFakeDraw } from '../testSupport/fakeDrawPort.mjs'; import { fakeCameraPort } from '../testSupport/fakeCameraPort.mjs'; @@ -22,23 +22,36 @@ const CAMERA = Object.freeze({ }); /** - * Mount the overlay in a happy-dom window with recorded media loads, timers - * and postRender listeners. `play` decides what each play() returns. + * Mount the overlay in the registered happy-dom window (Vue binds the + * document it loads with) with recorded media loads, timers and postRender + * listeners. `play` decides what each play() returns. */ function mountOverlay(t, { play = () => Promise.resolve() } = {}) { - const window = new Window({ url: 'http://localhost:4173/' }); - const previousWindow = globalThis.window; - const previousDocument = globalThis.document; - globalThis.window = window; - globalThis.document = window.document; + const { window } = globalThis; + const media = window.HTMLMediaElement.prototype; + const previous = { + load: media.load, + play: media.play, + pause: media.pause, + setInterval: window.setInterval, + clearInterval: window.clearInterval, + }; + t.after(() => { + media.load = previous.load; + media.play = previous.play; + media.pause = previous.pause; + window.setInterval = previous.setInterval; + window.clearInterval = previous.clearInterval; + delete window.document.hidden; + }); const loads = []; - window.HTMLMediaElement.prototype.load = function () { + media.load = function () { if (this.getAttribute('src')) loads.push(this.getAttribute('src')); }; - window.HTMLMediaElement.prototype.play = function () { + media.play = function () { return play(this); }; - window.HTMLMediaElement.prototype.pause = function () {}; + media.pause = function () {}; const intervals = new Map(); let nextTimer = 1; window.setInterval = (fn) => { @@ -65,12 +78,7 @@ function mountOverlay(t, { play = () => Promise.resolve() } = {}) { }); t.after(unbind); const overlay = createQuebecCctvOverlay(viewer); - t.after(() => { - overlay?.dispose(); - globalThis.window = previousWindow; - globalThis.document = previousDocument; - window.close(); - }); + t.after(() => overlay?.dispose()); const [live, still] = window.document.querySelectorAll('video'); return { window, @@ -203,3 +211,21 @@ test('the refresh timer reloads with a cache-buster, skips hidden tabs, and stop assert.equal(ui.renderListeners.size, 0); assert.equal(ui.window.document.querySelector('.qci-panel') === null, true); }); + +test('Escape in the window closes it and stops the refresh until the camera is picked again', (t) => { + const ui = mountOverlay(t); + ui.overlay.setCamera(CAMERA); + ui.playButton().click(); + const panel = ui.window.document.querySelector('.qci-panel'); + panel.dispatchEvent( + new ui.window.KeyboardEvent('keydown', { key: 'Escape', bubbles: true }), + ); + assert.equal(panel.hidden, true); + assert.equal(ui.intervals.size, 0); + + ui.overlay.setCamera({ ...CAMERA }); + assert.equal(panel.hidden, true, 'a routine update keeps it closed'); + ui.overlay.setCamera({ ...CAMERA }, { reselected: true }); + assert.equal(panel.hidden, false, 'picking the camera again reopens it'); + assert.equal(ui.intervals.size, 1); +}); diff --git a/src/ui/views/panels/QuebecCctvOverlay.vue b/src/ui/views/panels/QuebecCctvOverlay.vue new file mode 100644 index 0000000000..e13a5e56fb --- /dev/null +++ b/src/ui/views/panels/QuebecCctvOverlay.vue @@ -0,0 +1,110 @@ + + + + From 10a26e15cede13f80bc2b658ab3c503f2c22aded Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 02:10:49 -0800 Subject: [PATCH 07/42] Vue: the Omnibar's guided walk is a single-file component OmnibarGuide renders the walk's spotlight ring and callout, teleported to the end of the body as before, with the kit's UiCloseButton for its close and UiButtons for Not now, the offer and Next. startGuide() keeps its signature and every decision and word: it renders the view synchronously from what it computes for each step and keeps the parts the template never binds: the guide's visible class and the callout's entrance replay (in the same order, so the first step still fades in), the callout's place and side and the rings' boxes each frame, focus and its return, Escape and the checks for a screen another surface owns. The ids, roles, aria attributes, hidden attributes, tabindex, text and focus order are unchanged. The buttons gain the kit's classes, which carry no rules, so they look as before. The close drops the aria-hidden span around its glyph: its name is still its aria-label, "End guide", and its tip the same words. Progress segments are new elements each step, as before, so a segment's colour does not animate across steps, and the status line changes once per step. New tests: the walk is the last of the body, takes focus and gives it back, announces each step once and draws new progress each step, and a new walk ends the one in progress. Co-authored-by: Manjunath Paparaju --- docs/VUE-MIGRATION.md | 11 +- scripts/format-scope.json | 1 + scripts/package-boundaries.json | 1 + src/ui/omnibarGuide.js | 151 ++++++++++++++------------- src/ui/omnibarGuide.test.mjs | 111 ++++++++++++++++++++ src/ui/styles/close-button.css | 9 +- src/ui/views/panels/OmnibarGuide.vue | 89 ++++++++++++++++ 7 files changed, 293 insertions(+), 80 deletions(-) create mode 100644 src/ui/omnibarGuide.test.mjs create mode 100644 src/ui/views/panels/OmnibarGuide.vue diff --git a/docs/VUE-MIGRATION.md b/docs/VUE-MIGRATION.md index b7c030dc10..ebb3b1d4cc 100644 --- a/docs/VUE-MIGRATION.md +++ b/docs/VUE-MIGRATION.md @@ -108,8 +108,9 @@ no tip unless the site passes a `title`; attributes and classes pass through, so each site keeps its id, feature class and look. Every close, dismiss and clear button in the views is one (`src/ui/kit/closeButtons.test.mjs` pins it); Street Level's and the space mission's keep `bare`, since their skins -set their own padding and border. The close buttons built in script (credits, the -Quebec CCTV overlay, the guide) are not converted yet. +set their own padding and border. The Omnibar guide's close is one too, +keeping its feature class and tip. The close buttons built in script +(credits, the Quebec CCTV overlay) are not converted yet. `UiSearchField` takes `v-model`, a required `label` (the input's accessible name), `placeholder` and `tag` (`div`, given `role="search"` by the site, or `label`); attributes and classes go to the frame, and @@ -290,7 +291,11 @@ a feature supplying only its accent. `gev-location` store, and the search field keeps its listeners; beside the voice control, the dock teleports each voice pointer reticle to the body where its `PointerReticle` presents it in the `gev-pointer-reticle` - store), the phone shell (`PhoneTabBar` renders the tabs and open sheet the shell + store; `startGuide()` renders the Omnibar's guided walk, `OmnibarGuide`, + synchronously from the view it computes for each step, teleported to the + end of the body, and keeps every decision and word, focus and its return, + Escape, the entrance replay, and the callout's and spotlight rings' place + each frame), the phone shell (`PhoneTabBar` renders the tabs and open sheet the shell publishes to the `gev-display` store, teleporting the tab bar and sheet backdrop to the end of the page from the first publish until the shell is destroyed; the shell takes their clicks from the document), the diff --git a/scripts/format-scope.json b/scripts/format-scope.json index 76004da995..a947ca4cde 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -1624,6 +1624,7 @@ "src/tooling/wikidataPlaceTiles.test.mjs", "src/ui/omnibarIntent.test.mjs", "src/ui/omnibarRows.test.mjs", + "src/ui/omnibarGuide.test.mjs", "src/ui/styles/omnibar-dock.css", "src/ui/styles/guide.css", "src/ui/commandDock.test.mjs", diff --git a/scripts/package-boundaries.json b/scripts/package-boundaries.json index caf06537ef..7da835f67b 100644 --- a/scripts/package-boundaries.json +++ b/scripts/package-boundaries.json @@ -300,6 +300,7 @@ "src/exclusiveSurfaces.js", "src/geoDistance.js", "src/ui/omnibarGuide.js", + "src/ui/views/panels/OmnibarGuide.vue", "src/cityPois.js", "src/search/photonSetting.js", "src/sources/requestDeadline.js", diff --git a/src/ui/omnibarGuide.js b/src/ui/omnibarGuide.js index bcfe8d5b50..6903357400 100644 --- a/src/ui/omnibarGuide.js +++ b/src/ui/omnibarGuide.js @@ -13,9 +13,11 @@ // features (styles, HUD, compass, tilt, globe view, share, clear) have their // own. The walk works the same for all of them. +import { h, render as renderVue } from 'vue'; import { t } from '../i18n/index.js'; import { EXCLUSIVE_SURFACE_CLASSES } from '../exclusiveSurfaces.js'; import { LABEL_LAYERS } from './contextLayerTabs.js'; +import OmnibarGuide from './views/panels/OmnibarGuide.vue'; const LEFT_RAIL = '.ui-rail--left .ui-rail__item'; const RIGHT_RAIL = '.ui-rail--right .ui-rail__item'; @@ -445,43 +447,69 @@ export function startGuide(steps, { title = '' } = {}) { active?.stop(); const doc = globalThis.document; if (!doc?.body || screenIsOwned(doc) || !steps?.length) return; - const root = doc.createElement('div'); - root.className = 'gev-guide'; - root.innerHTML = - '
' + - ''; + status: '', + }; + const host = doc.createElement('div'); + const handlers = { + onClose: () => stop(), + onSkip: () => stop(), + // Taking the offer carries the walk on with its steps. + onOffer() { + if (!current?.offer) return; + const extra = current.offer.steps() || []; + live.splice(index + 1, live.length, ...extra.filter(Boolean)); + next(); + }, + onNext() { + if (current) next(); + }, + }; + let mounted = true; + /** Render the view now: the guide goes to the end of the body. */ + function paint() { + if (!mounted) return null; + const vnode = h(OmnibarGuide, { + to: doc.body, + view: { ...view }, + ...handlers, + }); + renderVue(vnode, host); + return vnode.component.exposed; + } // Focus returns where it was when the walk ends, if that is still there. const returnFocus = doc.activeElement; - doc.body.append(root); - const ring = root.querySelector('.gev-guide-ring'); - const callout = root.querySelector('.gev-guide-callout'); + const elements = paint(); + const root = elements.root.value; + const ring = elements.ring.value; + const callout = elements.callout.value; const subRings = []; - const endLabel = t('End guide'); - root.querySelector('.gev-guide-close').setAttribute('aria-label', endLabel); - root.querySelector('.gev-guide-close').title = endLabel; - // i18n-ignore: the Escape keycap, matching the keyboard shortcut. - root.querySelector('.gev-guide-keys kbd').textContent = 'Esc'; - root.querySelector('.gev-guide-keys span').textContent = t('to end'); - root.querySelector('.gev-guide-title').textContent = title - ? t('Guide · {topic}', { topic: title }) - : t('Guide'); - root.querySelector('.gev-guide-next').textContent = t('Next'); - root.querySelector('.gev-guide-hint span:last-child').textContent = t( - 'Press the highlighted control', - ); const live = steps.filter(Boolean); let index = -1; @@ -503,7 +531,8 @@ export function startGuide(steps, { title = '' } = {}) { doc.removeEventListener('click', onClick, true); doc.removeEventListener('keydown', onKey, true); const hadFocus = root.contains(doc.activeElement); - root.remove(); + mounted = false; + renderVue(null, host); if (hadFocus && returnFocus?.isConnected) returnFocus.focus?.(); if (active?.stop === stop) active = null; }; @@ -534,41 +563,29 @@ export function startGuide(steps, { title = '' } = {}) { // would not be skipped as things stand. const total = shown + live.slice(index + 1).filter((later) => !later.skip?.()).length; - root.querySelector('.gev-guide-count').textContent = `${shown} / ${total}`; - const progress = root.querySelector('.gev-guide-progress'); - progress.replaceChildren( - ...Array.from({ length: total }, (_, i) => { - const dot = doc.createElement('li'); - if (i < shown - 1) dot.className = 'done'; - if (i === shown - 1) dot.className = 'current'; - return dot; - }), + view.count = `${shown} / ${total}`; + view.step = shown; + view.progress = Array.from({ length: total }, (_, i) => + i < shown - 1 ? 'done' : i === shown - 1 ? 'current' : null, ); const text = step.text(); - root.querySelector('.gev-guide-text').textContent = text; - root.querySelector('.gev-guide-status').textContent = - `${shown} / ${total}: ${text}`; + view.text = text; + view.status = `${shown} / ${total}: ${text}`; // Steps that point at a control wait for it to be pressed; say so. const waits = Boolean(step.targets) && !step.offer; - root.querySelector('.gev-guide-hint').hidden = !waits; - const offer = root.querySelector('.gev-guide-offer'); - const skip = root.querySelector('.gev-guide-skip'); - offer.hidden = !step.offer; - skip.hidden = !step.offer; - root.querySelector('.gev-guide-keys').hidden = Boolean(step.offer); + view.hintHidden = !waits; + view.offerHidden = !step.offer; + view.skipHidden = !step.offer; + view.keysHidden = Boolean(step.offer); if (step.offer) { - offer.textContent = step.offer.label(); - skip.textContent = t('Not now'); + view.offerLabel = step.offer.label(); + view.skipLabel = t('Not now'); } const last = index === live.length - 1; - const nextButton = root.querySelector('.gev-guide-next'); - nextButton.hidden = Boolean(step.offer); - nextButton.textContent = last - ? t('Finish') - : waits - ? t('Skip step') - : t('Next'); - nextButton.classList.toggle('quiet', waits && !last); + view.nextHidden = Boolean(step.offer); + view.nextLabel = last ? t('Finish') : waits ? t('Skip step') : t('Next'); + view.nextQuiet = waits && !last; + paint(); // Replay the entrance so each step reads as new. callout.classList.remove('swap'); void callout.offsetWidth; @@ -597,18 +614,6 @@ export function startGuide(steps, { title = '' } = {}) { event.stopPropagation(); stop(); } - root.querySelector('.gev-guide-skip').addEventListener('click', stop); - root.querySelector('.gev-guide-close').addEventListener('click', stop); - root.querySelector('.gev-guide-next').addEventListener('click', () => { - if (current) next(); - }); - // Taking the offer carries the walk on with its steps. - root.querySelector('.gev-guide-offer').addEventListener('click', () => { - if (!current?.offer) return; - const extra = current.offer.steps() || []; - live.splice(index + 1, live.length, ...extra.filter(Boolean)); - next(); - }); doc.addEventListener('click', onClick, true); doc.addEventListener('keydown', onKey, true); diff --git a/src/ui/omnibarGuide.test.mjs b/src/ui/omnibarGuide.test.mjs new file mode 100644 index 0000000000..b221f73a69 --- /dev/null +++ b/src/ui/omnibarGuide.test.mjs @@ -0,0 +1,111 @@ +// The guided walk's callout, rendered by startGuide() over happy-dom. +import '../testSupport/registerDom.mjs'; +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { startGuide } from './omnibarGuide.js'; + +const settle = () => new Promise((resolve) => setTimeout(resolve, 0)); +const $ = (selector) => document.querySelector(selector); + +function fixture(t) { + document.body.replaceChildren(); + const target = document.body.appendChild(document.createElement('button')); + const field = document.body.appendChild(document.createElement('input')); + field.focus(); + t.after(() => $('.gev-guide-close')?.click()); + return { target, field }; +} + +test('the walk is the last of the body, takes focus and gives it back', async (t) => { + const { target, field } = fixture(t); + startGuide([{ targets: () => [target], text: () => 'Press it' }], { + title: 'Flights', + }); + await settle(); + const guide = $('.gev-guide'); + assert.equal(document.body.lastElementChild, guide); + assert.equal(guide.parentElement, document.body); + assert.ok(guide.classList.contains('visible')); + const callout = $('.gev-guide-callout'); + assert.equal(document.activeElement, callout); + assert.equal(callout.getAttribute('role'), 'dialog'); + assert.equal(callout.getAttribute('aria-modal'), 'false'); + assert.equal(callout.getAttribute('tabindex'), '-1'); + assert.equal($('.gev-guide-title').textContent, 'Guide · Flights'); + const close = $('.gev-guide-close'); + assert.equal(close.getAttribute('type'), 'button'); + assert.equal(close.getAttribute('aria-label'), 'End guide'); + assert.equal(close.getAttribute('title'), 'End guide'); + assert.ok(close.classList.contains('ui-close-button')); + close.focus(); + close.click(); + assert.equal($('.gev-guide'), null); + assert.equal(document.activeElement, field); +}); + +test('the status line says each step once, and each step draws new progress', async (t) => { + const { target } = fixture(t); + startGuide([ + { targets: () => [target], text: () => 'Press it' }, + { text: () => 'Then this' }, + { + text: () => 'More?', + offer: { label: () => 'Show more', steps: () => [] }, + }, + ]); + const status = $('.gev-guide-status'); + const said = []; + // One change per step: its text replaced once, never cleared first. + const observer = new MutationObserver(() => said.push(status.textContent)); + observer.observe(status, { + childList: true, + characterData: true, + subtree: true, + }); + t.after(() => observer.disconnect()); + await settle(); + const firstDots = [...document.querySelectorAll('.gev-guide-progress li')]; + assert.deepEqual( + firstDots.map((dot) => dot.getAttribute('class')), + ['current', null, null], + ); + const next = $('.gev-guide-next'); + assert.equal(next.textContent, 'Skip step'); + assert.ok(next.classList.contains('quiet')); + assert.equal($('.gev-guide-hint').hidden, false); + next.click(); + await settle(); + const secondDots = [...document.querySelectorAll('.gev-guide-progress li')]; + assert.deepEqual( + secondDots.map((dot) => dot.getAttribute('class')), + ['done', 'current', null], + ); + assert.ok(secondDots.every((dot) => !firstDots.includes(dot))); + assert.equal(next.textContent, 'Next'); + assert.equal(next.classList.contains('quiet'), false); + assert.equal($('.gev-guide-hint').hidden, true); + next.click(); + await settle(); + // The closing offer: its two buttons, no Esc hint and no Next. + assert.equal($('.gev-guide-keys').hidden, true); + assert.equal(next.hidden, true); + assert.equal($('.gev-guide-skip').hidden, false); + assert.equal($('.gev-guide-skip').textContent, 'Not now'); + assert.equal($('.gev-guide-offer').textContent, 'Show more'); + assert.deepEqual(said, [ + '1 / 3: Press it', + '2 / 3: Then this', + '3 / 3: More?', + ]); + $('.gev-guide-skip').click(); + assert.equal($('.gev-guide'), null); +}); + +test('starting another walk ends the one in progress', async (t) => { + fixture(t); + startGuide([{ text: () => 'First' }]); + startGuide([{ text: () => 'Second' }]); + await settle(); + assert.equal(document.querySelectorAll('.gev-guide').length, 1); + assert.equal($('.gev-guide-text').textContent, 'Second'); +}); diff --git a/src/ui/styles/close-button.css b/src/ui/styles/close-button.css index a17c605fd1..d8fddb540e 100644 --- a/src/ui/styles/close-button.css +++ b/src/ui/styles/close-button.css @@ -1,9 +1,10 @@ /* Core's close, dismiss and clear buttons draw a bare glyph: no padding, * border or background of their own, and a pointer. The kit's - * UiCloseButton wears it as .ui-close-button; the guide's close button, - * built in script, shares the rule. It selects one class and loads before - * the feature stylesheets, so each feature rule still sets its size, colour, - * hover and any surface (a border, a chip, a tinted square). */ + * UiCloseButton wears it as .ui-close-button, and the guide's close (a + * UiCloseButton too) shares the rule by its feature class. It selects one + * class and loads before the feature stylesheets, so each feature rule still + * sets its size, colour, hover and any surface (a border, a chip, a tinted + * square). */ .ui-close-button, .gev-guide-close { padding: 0; diff --git a/src/ui/views/panels/OmnibarGuide.vue b/src/ui/views/panels/OmnibarGuide.vue new file mode 100644 index 0000000000..3be5b9b852 --- /dev/null +++ b/src/ui/views/panels/OmnibarGuide.vue @@ -0,0 +1,89 @@ + + + + From b5fcc39bc02e6a0ec52813a49fc7a1cc06d90ff7 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 02:14:22 -0800 Subject: [PATCH 08/42] Add the changelog entry for #1844 Co-authored-by: Manjunath Paparaju --- changelog.d/1844-sfc-credits.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog.d/1844-sfc-credits.md diff --git a/changelog.d/1844-sfc-credits.md b/changelog.d/1844-sfc-credits.md new file mode 100644 index 0000000000..df9de4f430 --- /dev/null +++ b/changelog.d/1844-sfc-credits.md @@ -0,0 +1,3 @@ +- The data credits line and its list are now a single-file component. The + close button is the kit's, and a focused link keeps focus when the list + redraws (manjunath22466, samehkhamis, #1844). From 4a6f185d0785d93e53eb83e0b86dd9dbaf6c59fe Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 02:16:38 -0800 Subject: [PATCH 09/42] The guided walk finds its elements in the rendered tree Template refs are filled after a render returns, and later still when the walk starts inside one of Vue's own post-render updates, where the walk would have failed with its listeners already in place. Co-authored-by: Manjunath Paparaju --- src/ui/omnibarGuide.js | 12 +++++++----- src/ui/omnibarGuide.test.mjs | 25 +++++++++++++++++++++++++ src/ui/views/panels/OmnibarGuide.vue | 13 +++---------- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/ui/omnibarGuide.js b/src/ui/omnibarGuide.js index 6903357400..0e1a668a80 100644 --- a/src/ui/omnibarGuide.js +++ b/src/ui/omnibarGuide.js @@ -501,14 +501,16 @@ export function startGuide(steps, { title = '' } = {}) { ...handlers, }); renderVue(vnode, host); - return vnode.component.exposed; + return vnode; } // Focus returns where it was when the walk ends, if that is still there. const returnFocus = doc.activeElement; - const elements = paint(); - const root = elements.root.value; - const ring = elements.ring.value; - const callout = elements.callout.value; + // The elements come from the rendered tree, which is in place as soon as the + // render returns; template refs are filled after it, and later still when + // the walk starts inside one of Vue's own post-render updates. + const root = paint().component.subTree.children[0].el; + const ring = root.querySelector(':scope > .gev-guide-ring'); + const callout = root.querySelector(':scope > .gev-guide-callout'); const subRings = []; const live = steps.filter(Boolean); diff --git a/src/ui/omnibarGuide.test.mjs b/src/ui/omnibarGuide.test.mjs index b221f73a69..615f7d2f8f 100644 --- a/src/ui/omnibarGuide.test.mjs +++ b/src/ui/omnibarGuide.test.mjs @@ -2,6 +2,7 @@ import '../testSupport/registerDom.mjs'; import test from 'node:test'; import assert from 'node:assert/strict'; +import { createApp, h, onMounted } from 'vue'; import { startGuide } from './omnibarGuide.js'; const settle = () => new Promise((resolve) => setTimeout(resolve, 0)); @@ -109,3 +110,27 @@ test('starting another walk ends the one in progress', async (t) => { assert.equal(document.querySelectorAll('.gev-guide').length, 1); assert.equal($('.gev-guide-text').textContent, 'Second'); }); + +test('a walk started while Vue mounts something else still starts and ends', async (t) => { + const { target, field } = fixture(t); + let stop = null; + const app = createApp({ + setup() { + onMounted(() => { + stop = startGuide([ + { targets: () => [target], text: () => 'Press it' }, + ]); + }); + return () => h('span'); + }, + }); + app.mount(document.body.appendChild(document.createElement('div'))); + t.after(() => app.unmount()); + await settle(); + assert.equal(typeof stop, 'function'); + assert.equal(document.activeElement, $('.gev-guide-callout')); + assert.ok($('.gev-guide').classList.contains('visible')); + stop(); + assert.equal($('.gev-guide'), null); + assert.equal(document.activeElement, field); +}); diff --git a/src/ui/views/panels/OmnibarGuide.vue b/src/ui/views/panels/OmnibarGuide.vue index 3be5b9b852..71f1c95069 100644 --- a/src/ui/views/panels/OmnibarGuide.vue +++ b/src/ui/views/panels/OmnibarGuide.vue @@ -1,5 +1,4 @@ From c7df3c67982c0a905796b28328f6f5b218484c1f Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Thu, 19 Nov 2026 15:00:17 +0400 Subject: [PATCH 16/42] 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 17/42] 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(() => { From b875b5f46927a5442ee7b975d88fd36fcb45a65d Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 10:39:48 -0800 Subject: [PATCH 31/42] Vue kit: the Cockpit's buttons and glyphs are kit controls Every hand-written button in the Cockpit HUD (CockpitView, the utility strip, the briefing and Contact cards, the signal rows, the orbital view and the bridge radar) is a ghost UiButton that keeps its id, classes, data and aria attributes, title and listeners, so the Cockpit controller and the cockpit stylesheets still find it. Radio's Enable, the briefing's Auto and the Contact card's Weather are pressed toggles written as :pressed="Boolean(...)". Every Material Symbols span (the rim pointers, reticle, heading caret, vision and card chevrons, panel glyphs, the contact and route arrows, the rail and view switcher glyphs) is a UiIcon with :size="null", so the cockpit rules still size it. The orbital view's focus hand-off reads each UiButton ref's $el. The heading caret's rule now reads `.cockpit-compass .cockpit-heading-caret` so it still outranks kit.css's `.ui-icon` display and line height, which load after cockpit.css. The Cockpit markup test reads the Reset and Exit buttons' attributes in any order. src/ui/kit/cockpitControls.test.mjs pins it: no hand-written button, Material span, select, checkbox or range in the Cockpit views, the kit counts per file, the pressed toggles and the caret rule. Co-authored-by: Manjunath Paparaju --- docs/VUE-MIGRATION.md | 17 ++ scripts/format-scope.json | 1 + src/cockpitMarkup.test.mjs | 25 ++- src/ui/kit/cockpitControls.test.mjs | 148 ++++++++++++++++++ src/ui/styles/cockpit.css | 4 +- src/ui/views/CockpitView.vue | 42 ++--- src/ui/views/panels/CockpitBriefing.vue | 25 +-- src/ui/views/panels/CockpitContext.vue | 21 +-- src/ui/views/panels/CockpitOrbital.vue | 16 +- src/ui/views/panels/CockpitRadar.vue | 3 +- src/ui/views/panels/CockpitRoute.vue | 3 +- src/ui/views/panels/CockpitSignalList.vue | 4 +- .../views/panels/CockpitUtilityControls.vue | 21 +-- 13 files changed, 261 insertions(+), 69 deletions(-) create mode 100644 src/ui/kit/cockpitControls.test.mjs diff --git a/docs/VUE-MIGRATION.md b/docs/VUE-MIGRATION.md index d82f798808..7c8c75d8e5 100644 --- a/docs/VUE-MIGRATION.md +++ b/docs/VUE-MIGRATION.md @@ -122,6 +122,23 @@ magnifier would replace their SVG one, and Explore's two clear buttons, which draw an SVG cross, are ghost `UiButton`s rather than `UiCloseButton`s (`src/ui/kit/storiesControls.test.mjs` pins it). Explore's sort is a `UiSelect`. +Every button in the Cockpit HUD (`CockpitView` and its panels: the vision +selector, Look ahead, the view switcher's Reset and Exit, the utility +strip's launchers, collapse buttons, Radio transport and desktop rail, the +briefing card's paging, Auto, collapse and page tabs, the Contact card's +navigation, collapse and Weather, a signal row's target, the orbital +view's TLE, Nadir, zoom and Sensor, and the bridge radar's range) is a +ghost `UiButton` that keeps its id and classes, so the Cockpit +controller's listeners and the cockpit stylesheets still find it. Radio's +Enable (with `active`), Auto and Weather are pressed toggles; the +disclosures keep `aria-expanded` and the page tabs `aria-current`. Its +glyphs (the rim pointers, the reticle, the heading caret, the chevrons and +panel glyphs, the contact and route arrows) are `UiIcon`s with +`:size="null"`; the heading caret's rule reads +`.cockpit-compass .cockpit-heading-caret`, so it still outranks the kit's +`.ui-icon`, which loads after cockpit.css +(`src/ui/kit/cockpitControls.test.mjs` pins it). The −, ◀ ▶ and + glyphs +are text characters and stay text, and the Radio volume is a `UiSlider`. The Omnibar's mic (a pressed toggle with `active`) and its suggestion strip's chips (options, so `aria-current` rather than `pressed`) are ghost `UiButton`s, and its search, row and chip glyphs are `UiIcon`s with diff --git a/scripts/format-scope.json b/scripts/format-scope.json index ebfa59916f..89c232b4f5 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -1350,6 +1350,7 @@ "src/ui/kit/welcomeControls.test.mjs", "src/ui/kit/omnibarControls.test.mjs", "src/ui/kit/storiesControls.test.mjs", + "src/ui/kit/cockpitControls.test.mjs", "src/ui/styles/chip.css", "src/ui/styles/empty-state.css", "src/ui/rail/RailChips.vue", diff --git a/src/cockpitMarkup.test.mjs b/src/cockpitMarkup.test.mjs index 3a084af32f..d24f97fbb3 100644 --- a/src/cockpitMarkup.test.mjs +++ b/src/cockpitMarkup.test.mjs @@ -74,10 +74,14 @@ const voiceActions = fs.readFileSync( test('Cockpit has one reset action beside its bottom exit path', () => { assert.doesNotMatch(html, /id="cockpit-quick-entry"/); assert.doesNotMatch(html, /id="cockpit-exit"/); - assert.match( - html, - /id="map-view-switch"[^>]*aria-label="Exit cockpit view"[^>]*aria-keyshortcuts="Escape"[\s\S]*?close_fullscreen[\s\S]*?EXIT COCKPIT/, + // The exit button's attributes, in whatever order the button renders them. + const exit = html.match( + /]*\sid="map-view-switch")([^>]*)>([\s\S]*?)<\/button>/, ); + assert.ok(exit, 'Cockpit exit is missing'); + assert.match(exit[1], /\saria-label="Exit cockpit view"/); + assert.match(exit[1], /\saria-keyshortcuts="Escape"/); + assert.match(exit[2], /close_fullscreen[\s\S]*?EXIT COCKPIT/); const topCenterActions = html.match( /
- arrow_right + {{ hud.speedRim.value }}
@@ -183,7 +185,7 @@ const tickStyle = (tick) =>
{{ hud.altitudeRim.value }} - arrow_left +
@@ -193,21 +195,21 @@ const tickStyle = (tick) => {{ hud.meta.text }}
- - - + +
- +
{{ hud.banner.title }} @@ -216,9 +218,9 @@ const tickStyle = (tick) =>
{{ look.readout }} - +
@@ -241,7 +243,7 @@ const tickStyle = (tick) => {{ t('FT') }}
- +
@@ -274,13 +276,13 @@ const tickStyle = (tick) => diff --git a/src/ui/views/panels/CockpitBriefing.vue b/src/ui/views/panels/CockpitBriefing.vue index cbb37b9358..7c31ff95c1 100644 --- a/src/ui/views/panels/CockpitBriefing.vue +++ b/src/ui/views/panels/CockpitBriefing.vue @@ -7,6 +7,7 @@ import { useCockpitStore } from '../../stores/cockpit.js'; import CockpitRoute from './CockpitRoute.vue'; import CockpitSignalList from './CockpitSignalList.vue'; import UiButton from '../../kit/UiButton.vue'; +import UiIcon from '../../kit/UiIcon.vue'; // The Cockpit briefing card. The Cockpit controller presents its pages, // cycle toggle, regional news and local conditions; until it does, the card @@ -45,17 +46,17 @@ function leaveSignals() { {{ b.subtitle }}
@@ -83,9 +84,9 @@ function leaveSignals() {
{{ b.source }}
diff --git a/src/ui/views/panels/CockpitContext.vue b/src/ui/views/panels/CockpitContext.vue index 2374deb3ed..024d576b1e 100644 --- a/src/ui/views/panels/CockpitContext.vue +++ b/src/ui/views/panels/CockpitContext.vue @@ -6,6 +6,7 @@ import { createContextState } from '../../cockpitContextState.js'; import { vClassToggle } from '../../rail/classToggle.js'; import { useCockpitStore } from '../../stores/cockpit.js'; import UiButton from '../../kit/UiButton.vue'; +import UiIcon from '../../kit/UiIcon.vue'; // The Cockpit Contact card. The Cockpit controller presents its scope, // navigation, cohort counts, nearest contact and weather toggle; until it @@ -36,15 +37,15 @@ const weatherLabel = computed(() => {{ c.subject }}
{{ t('CONTEXT ONLY') }} @@ -55,7 +56,7 @@ const weatherLabel = computed(() =>
{{ t('SITE') }}{{ c.cohorts['military-installations'].count }}{{ c.cohorts['military-installations'].source }}
- +
{{ t('NEAREST OBSERVED / MAPPED') }} {{ c.nearest.label }} diff --git a/src/ui/views/panels/CockpitOrbital.vue b/src/ui/views/panels/CockpitOrbital.vue index e43848d7e9..09b6817fba 100644 --- a/src/ui/views/panels/CockpitOrbital.vue +++ b/src/ui/views/panels/CockpitOrbital.vue @@ -14,6 +14,7 @@ import { shownOwnerMark, } from '../../ownerFlag.js'; import { useCockpitStore } from '../../stores/cockpit.js'; +import UiButton from '../../kit/UiButton.vue'; // The orbital view's HUD: a nadir reticle over the picture, the satellite's // identity and orbit, and the optical zoom. The Cockpit controller presents @@ -118,14 +119,15 @@ const sensorStepShown = computed( // A focused control that turns off (a zoom button at the end of its range, // SENSOR as the view tilts away) hands focus on instead of dropping it to the // page. The watchers run before the re-render, while it still has focus. +// Each ref holds a UiButton, whose element is its `$el`. const zoomInButton = ref(null); const zoomOutButton = ref(null); const sensorButton = ref(null); const nadirButton = ref(null); const handFocus = (from, to) => { - if (!from || document.activeElement !== from) return; + if (!from?.$el || document.activeElement !== from.$el) return; nextTick(() => - (to() ?? document.getElementById('map-view-switch'))?.focus({ + (to()?.$el ?? document.getElementById('map-view-switch'))?.focus({ preventScroll: true, }), ); @@ -298,7 +300,7 @@ const lensStyle = computed(() => {
- + {{ t('TLE') }}
{{ tleText }}
@@ -319,17 +321,17 @@ const lensStyle = computed(() => {
{{ look.readout }} - + {{ t('NADIR') }}

{{ focusText }}

- + − {{ zoomText }} - + + {{ swathText }} {{ sensorText }} - + {{ t('SENSOR') }}
diff --git a/src/ui/views/panels/CockpitRadar.vue b/src/ui/views/panels/CockpitRadar.vue index 58d63380d0..e4377ecbc5 100644 --- a/src/ui/views/panels/CockpitRadar.vue +++ b/src/ui/views/panels/CockpitRadar.vue @@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia'; import { computed, onBeforeUnmount, ref, watch } from 'vue'; import { formatNumber, t, tn } from '../../../i18n/index.js'; import { useCockpitStore } from '../../stores/cockpit.js'; +import UiButton from '../../kit/UiButton.vue'; // The bridge radar: a heading-up scope of nearby AIS vessels, with a line // where the bridge view looks when it is turned off the bow. The Cockpit @@ -158,7 +159,7 @@ const rangeAction = computed(() =>
- + {{ rangeLabel }} {{ ringLabel }} {{ countLabel }}
diff --git a/src/ui/views/panels/CockpitRoute.vue b/src/ui/views/panels/CockpitRoute.vue index 9d8b4d4f44..6cb18869e8 100644 --- a/src/ui/views/panels/CockpitRoute.vue +++ b/src/ui/views/panels/CockpitRoute.vue @@ -4,6 +4,7 @@ import { computed } from 'vue'; import { t } from '../../../i18n/index.js'; import { createRouteState } from '../../cockpitInstrumentState.js'; import { useCockpitStore } from '../../stores/cockpit.js'; +import UiIcon from '../../kit/UiIcon.vue'; // The Cockpit flight plan card. The Cockpit controller presents the route's // endpoints and whether a destination direction exists; until it does, the @@ -39,7 +40,7 @@ const label = computed(() => {{ t('FROM') }} {{ r.from }} - +
{{ t('TO') }} {{ r.to }} diff --git a/src/ui/views/panels/CockpitSignalList.vue b/src/ui/views/panels/CockpitSignalList.vue index 0e02005962..3b463dd39d 100644 --- a/src/ui/views/panels/CockpitSignalList.vue +++ b/src/ui/views/panels/CockpitSignalList.vue @@ -3,6 +3,8 @@ import { storeToRefs } from 'pinia'; import { computed } from 'vue'; import { vFocusSafeChildren } from '../../rail/focusSafeChildren.js'; import { useCockpitStore } from '../../stores/cockpit.js'; +import UiButton from '../../kit/UiButton.vue'; +import UiIcon from '../../kit/UiIcon.vue'; // The Cockpit's live signal rows. The Cockpit controller presents them; // until it does, the list is empty. Rows reorder several times a second, @@ -18,5 +20,5 @@ const rows = computed(() => signals.value ?? []); diff --git a/src/ui/views/panels/CockpitUtilityControls.vue b/src/ui/views/panels/CockpitUtilityControls.vue index 956fb2f63c..0254cf3f04 100644 --- a/src/ui/views/panels/CockpitUtilityControls.vue +++ b/src/ui/views/panels/CockpitUtilityControls.vue @@ -8,6 +8,7 @@ import { useRadioStore } from '../../stores/radio.js'; import { useCockpitStore } from '../../stores/cockpit.js'; import { useDisplayStore } from '../../stores/display.js'; import UiButton from '../../kit/UiButton.vue'; +import UiIcon from '../../kit/UiIcon.vue'; // The Cockpit's Display and Radio launchers and their popovers, and the // desktop look's rail, whose icons stay at the edge and open one panel at a @@ -54,8 +55,8 @@ const radioLabel = computed(() =>
{{ t('DISPLAY') }} - - + − + {{ open.display ? '▶' : '◀' }}
@@ -68,16 +69,16 @@ const radioLabel = computed(() =>
{{ t('RADIO') }} - - + − + {{ open.radio ? '▶' : '◀' }}
{{ cockpit ? cockpit.station : t('READY') }} - {{ cockpit ? cockpit.enable.text : t('ENABLE') }} + {{ cockpit ? cockpit.enable.text : t('ENABLE') }}
- - - + ◀◀ + {{ cockpit ? cockpit.play.glyph : '▶' }} + ▶▶
From 765869bcb24837301cef2347b196bc05a634020f Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 10:52:21 -0800 Subject: [PATCH 32/42] Add the changelog entry for #1856 Co-authored-by: Manjunath Paparaju --- changelog.d/1856-kit-sweep-small-surfaces.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog.d/1856-kit-sweep-small-surfaces.md diff --git a/changelog.d/1856-kit-sweep-small-surfaces.md b/changelog.d/1856-kit-sweep-small-surfaces.md new file mode 100644 index 0000000000..a3d6130ee1 --- /dev/null +++ b/changelog.d/1856-kit-sweep-small-surfaces.md @@ -0,0 +1,3 @@ +- The small views' buttons and glyphs (locale picker, phone tabs, globe + actions and compass, News and rail cards, credits, the Omnibar guide's + rings and others) are now kit controls (manjunath22466, samehkhamis, #1856). From 8b122dc25927dcb3ca62098f7ea37caa3d846fc0 Mon Sep 17 00:00:00 2001 From: Said Turksever Date: Thu, 19 Nov 2026 19:18:31 +0000 Subject: [PATCH 33/42] fix(render): wheel zoom no longer stalls with an icon under the canvas centre Below 150 km Cesium sizes a zoom step from the depth it picks at the canvas centre. Since #1835 an icon drawn over depth wrote a depth just past the near plane, which that pick took for a surface a near plane's distance from the camera: zooming in returned early and zooming out moved by centimetres. Over-depth rows now write a depth of exactly 0 in the fragment shader. It is never discarded (the flicker #1835 fixed stays fixed) and the depth pick reads it as nothing drawn, keeping the ground under the icon. Adds scripts/qa-zoom-under-icon.mjs (real browser) and a source-level unit test. --- docs/CURRENT-STATE.md | 10 + scripts/format-scope.json | 1 + scripts/qa-zoom-under-icon.mjs | 214 ++++++++++++++++++++ src/render/cesium/iconSetPrimitive.js | 25 ++- src/render/cesium/iconSetPrimitive.test.mjs | 27 +++ 5 files changed, 268 insertions(+), 9 deletions(-) create mode 100644 scripts/qa-zoom-under-icon.mjs diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 51dd971fe0..3f28e60806 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -93,6 +93,16 @@ settling. Oblique views below 300 km are left alone. `QA_BASE_URL=http://localhost:4173 node scripts/qa-zoom-out-guard.mjs` exercises the real browser controller at desktop and phone widths with keyless fixtures. +Below 150 km Cesium sizes a wheel or pinch zoom step from the depth it picks at +the canvas centre. Icons drawn over depth (aircraft, vessels and most markers: +`disableDepthTest: Infinity`) sit on the near plane and write a depth of +exactly 0 there (`src/render/cesium/iconSetPrimitive.js`), which that pick +reads as nothing drawn, so it keeps the ground under the icon. Any depth past +the near plane would be taken for a surface a near plane's distance from the +camera, and the zoom would stop while an icon is under the centre. +`QA_BASE_URL=http://localhost:5173 node scripts/qa-zoom-under-icon.mjs` checks +this against a dev server (`npm run dev`). + Cesium's free look (Shift+drag, which turns the camera in place) works only below 1,000 km. Above that height a few drags could turn the whole planet out of frame and leave only stars, so Shift+drag does nothing there. Cesium also turns diff --git a/scripts/format-scope.json b/scripts/format-scope.json index 9cbc1bda9a..d5b0aea10f 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -1290,6 +1290,7 @@ "src/render/cesium/zoomOutGuard.test.mjs", "src/app/controls.test.mjs", "scripts/qa-zoom-out-guard.mjs", + "scripts/qa-zoom-under-icon.mjs", "src/hudSummaryGate.test.mjs", "src/hudSummaryLine.test.mjs", "src/testSupport/stubMgrs.mjs", diff --git a/scripts/qa-zoom-under-icon.mjs b/scripts/qa-zoom-under-icon.mjs new file mode 100644 index 0000000000..2ae7f5366b --- /dev/null +++ b/scripts/qa-zoom-under-icon.mjs @@ -0,0 +1,214 @@ +#!/usr/bin/env node +/** + * Real-app regression: the wheel zooms with an over-depth icon under the + * centre of the canvas. Start a dev server (`npm run dev`), then run this + * file with QA_BASE_URL set to it. + * + * Below 150 km Cesium sizes a zoom step from the depth it picks at the canvas + * centre. An icon drawn over depth must leave nothing there for that pick, or + * the camera takes the icon (a metre away, on the near plane) for the ground + * and stops zooming. + */ +import assert from 'node:assert/strict'; +import puppeteer from 'puppeteer'; + +const origin = process.env.QA_BASE_URL || 'http://localhost:4173'; +const CAMERA_HEIGHT_M = 15_000; +const browser = await puppeteer.launch({ + headless: true, + args: [ + '--no-sandbox', + ...(process.platform === 'darwin' + ? ['--use-angle=metal', '--enable-gpu'] + : [ + '--use-gl=angle', + '--use-angle=swiftshader', + '--enable-unsafe-swiftshader', + ]), + ], + protocolTimeout: 120_000, +}); +const errors = []; +try { + const page = await browser.newPage(); + page.on('pageerror', (error) => errors.push(error.message)); + const viewport = { width: 1200, height: 800 }; + await page.setViewport(viewport); + await page.goto(`${origin}/?welcome=0`, { waitUntil: 'domcontentloaded' }); + await page.waitForFunction( + () => + window.__godsEyeView?.viewer && + window.__godsEyeView.viewer.scene.screenSpaceCameraController + .enableInputs && + document.getElementById('loading-screen')?.classList.contains('hidden'), + { timeout: 90_000 }, + ); + const setup = await page.evaluate(async (cameraHeight) => { + const C = await import('/node_modules/cesium/Build/Cesium/index.js'); + const { drawOf } = await import('/src/render/rendererOf.js'); + const viewer = window.__godsEyeView.viewer; + const scene = viewer.scene; + viewer.camera.cancelFlight(); + viewer.trackedEntity = undefined; + // Explicit real renders make each gesture independent of host frame rate. + viewer.useDefaultRenderLoop = false; + const controller = scene.screenSpaceCameraController; + controller.inertiaZoom = 0; + controller.inertiaSpin = 0; + const lon = -30; + const lat = 40; // open Atlantic: nothing else of the app's draws here + const icons = drawOf(viewer).icons({ id: 'qa-zoom-under-icon' }); + const item = { + id: 'qa-icon', + pos: C.Cartesian3.fromDegrees(lon, lat, 100), + // Held in place on the GPU, as a live aircraft or vessel icon is. + motion: { kind: 'hold', courseDeg: 0 }, + image: `data:image/svg+xml;charset=utf-8,${encodeURIComponent( + '', + )}`, + size: [64, 64], + disableDepthTest: Infinity, + }; + const centre = () => + new C.Cartesian2( + scene.canvas.clientWidth / 2, + scene.canvas.clientHeight / 2, + ); + const frame = () => { + scene.requestRender(); + viewer.render(); + }; + const qa = { + height: () => viewer.camera.positionCartographic.height, + setIcon(shown) { + icons.set(shown ? [item] : []); + }, + reset() { + viewer.camera.cancelFlight(); + viewer.camera.lookAtTransform(C.Matrix4.IDENTITY); + viewer.camera.setView({ + destination: C.Cartesian3.fromDegrees(lon, lat, cameraHeight), + orientation: { heading: 0, pitch: -C.Math.PI_OVER_TWO, roll: 0 }, + }); + frame(); + }, + async frames(count) { + for (let i = 0; i < count; i++) { + frame(); + await new Promise((resolve) => setTimeout(resolve, 0)); + } + return qa.height(); + }, + /** Whether the icon is what a click at the canvas centre picks. */ + iconAtCentre() { + const picked = scene.pick(centre()); + return JSON.stringify(picked?.id ?? null).includes('qa-icon'); + }, + /** Metres from the camera to what the depth pick finds at the centre. */ + centreDepthM() { + frame(); + const point = scene.pickPositionWorldCoordinates(centre()); + return point + ? C.Cartesian3.distance(point, viewer.camera.positionWC) + : null; + }, + }; + window.__zoomUnderIconQa = qa; + const gl = scene.context._gl; + const debug = gl.getExtension('WEBGL_debug_renderer_info'); + return { + renderer: gl.getParameter( + debug ? debug.UNMASKED_RENDERER_WEBGL : gl.RENDERER, + ), + logDepth: scene.logarithmicDepthBuffer, + pickPosition: scene.pickPositionSupported, + }; + }, CAMERA_HEIGHT_M); + console.log( + `[INFO] WebGL renderer: ${setup.renderer}; log depth ${setup.logDepth}`, + ); + assert.ok(setup.pickPosition, 'the context must support depth picks'); + + const qa = (method, ...args) => + page.evaluate( + (name, rest) => window.__zoomUnderIconQa[name](...rest), + method, + args, + ); + const x = viewport.width / 2; + const y = viewport.height / 2; + await page.mouse.move(x, y); + /** Wheel `deltaY` at the canvas centre, then the settled camera height. */ + const wheel = async (deltaY) => { + await qa('reset'); + await page.evaluate( + ({ x, y, deltaY }) => { + window.__godsEyeView.viewer.canvas.dispatchEvent( + new WheelEvent('wheel', { + deltaY, + clientX: x, + clientY: y, + bubbles: true, + cancelable: true, + }), + ); + }, + { x, y, deltaY }, + ); + return qa('frames', 40); + }; + + // The ground alone: what the icon must not change. + await qa('setIcon', false); + await qa('reset'); + await qa('frames', 10); + const groundDepth = await qa('centreDepthM'); + const groundIn = await wheel(-600); + const groundOut = await wheel(600); + console.log( + `[INFO] no icon: centre depth ${groundDepth?.toFixed(1)} m, wheel in to ${groundIn.toFixed(0)} m, out to ${groundOut.toFixed(0)} m`, + ); + assert.ok(groundIn < CAMERA_HEIGHT_M * 0.95, 'control: wheel in zooms in'); + assert.ok(groundOut > CAMERA_HEIGHT_M * 1.05, 'control: wheel out zooms out'); + + await qa('setIcon', true); + await qa('reset'); + await page.waitForFunction( + async () => { + await window.__zoomUnderIconQa.frames(1); + return window.__zoomUnderIconQa.iconAtCentre(); + }, + { timeout: 30_000 }, + ); + console.log('[PASS] the icon draws under the canvas centre'); + + const depth = await qa('centreDepthM'); + const zoomedIn = await wheel(-600); + const zoomedOut = await wheel(600); + console.log( + `[INFO] icon at centre: depth pick ${depth === null ? 'finds nothing' : `${depth.toFixed(3)} m away`}, wheel in to ${zoomedIn.toFixed(0)} m, out to ${zoomedOut.toFixed(0)} m`, + ); + assert.ok( + depth === null || depth > 100, + `the depth pick must not land on the icon (${depth} m from the camera)`, + ); + console.log('[PASS] the depth pick at the centre ignores the icon'); + assert.ok( + zoomedIn < CAMERA_HEIGHT_M * 0.95, + `wheel in must zoom in under an icon (height ${zoomedIn.toFixed(1)} m)`, + ); + console.log('[PASS] wheel in zooms in'); + assert.ok( + zoomedOut > CAMERA_HEIGHT_M * 1.05, + `wheel out must zoom out under an icon (height ${zoomedOut.toFixed(1)} m)`, + ); + console.log('[PASS] wheel out zooms out'); + + assert.ok(await qa('iconAtCentre'), 'the icon must still pick by click'); + console.log('[PASS] the icon still picks by click'); + + assert.deepEqual(errors, [], 'no JavaScript page errors'); + console.log('[PASS] no JavaScript page errors'); +} finally { + await browser.close(); +} diff --git a/src/render/cesium/iconSetPrimitive.js b/src/render/cesium/iconSetPrimitive.js index 432f78ffd1..581fb95f46 100644 --- a/src/render/cesium/iconSetPrimitive.js +++ b/src/render/cesium/iconSetPrimitive.js @@ -92,6 +92,7 @@ out vec2 v_uv; out vec4 v_color; out vec4 v_pickColor; out float v_proxy; +out float v_overDepth; // 1 for a row drawn over depth, on the near plane // The row's anchor in clip space before screen offsets, for effects that wrap // main() (sonar) and must not change geometry or picks. @@ -125,6 +126,7 @@ void main() { v_uv = vec2(0.0); v_color = vec4(0.0); v_proxy = 0.0; + v_overDepth = 0.0; gl_Position = vec4(0.0, 0.0, 2.0, 1.0); // outside the clip volume: not drawn float flags = style1.z; @@ -260,14 +262,9 @@ void main() { distanceSq < style3.w * style3.w; if (overDepth && zclip >= -1.0 && zclip <= 1.0) { gl_Position.z = -gl_Position.w; -#ifdef LOG_DEPTH - // Just past the near plane, not on it: czm_writeLogDepth discards a - // fragment at or below 0.9999999, and 1.0 interpolated across the quad - // can arrive a rounding step or two under that, dropping the icon for a - // frame as it moves (flicker). 1e-4 m past the near plane is still in - // front of everything the scene draws. - v_depthFromNearPlusOne = 1.0001; -#endif + // With a log depth buffer the fragment shader writes the near plane's + // depth itself. + v_overDepth = 1.0; } v_uv = mix(rect.xy, rect.zw, vec2(corner.x * 0.5 + 0.5, 0.5 - corner.y * 0.5)); @@ -282,6 +279,7 @@ in vec2 v_uv; in vec4 v_color; in vec4 v_pickColor; in float v_proxy; +in float v_overDepth; void main() { vec4 color = czm_gammaCorrect(texture(u_atlas, v_uv)); @@ -296,7 +294,16 @@ void main() { #endif out_FragColor = color; #ifdef LOG_DEPTH - czm_writeLogDepth(v_depthFromNearPlusOne); + // Over depth: exactly the near plane's depth, written here and not through + // czm_writeLogDepth. That function discards a fragment whose interpolated + // depth arrives a rounding step under the near plane (the icon drops for a + // frame as it moves), and any depth past the near plane is a surface to + // Cesium's depth pick: the camera controller then sizes a zoom step from an + // icon under the canvas centre, a near plane's distance away, and the wheel + // stops zooming. The pick reads a depth of 0 as nothing drawn, and keeps + // the depth of the ground under the icon. + if (v_overDepth > 0.5) gl_FragDepth = 0.0; + else czm_writeLogDepth(v_depthFromNearPlusOne); #endif } `; diff --git a/src/render/cesium/iconSetPrimitive.test.mjs b/src/render/cesium/iconSetPrimitive.test.mjs index 511acf676e..562a125a61 100644 --- a/src/render/cesium/iconSetPrimitive.test.mjs +++ b/src/render/cesium/iconSetPrimitive.test.mjs @@ -1,5 +1,6 @@ import assert from 'node:assert/strict'; import test from 'node:test'; +import fs from 'node:fs'; import * as Cesium from 'cesium'; import { createIconSet } from '../../data/iconSet.js'; import { IconSetPrimitive } from './iconSetPrimitive.js'; @@ -58,3 +59,29 @@ test('by default the set draws an opaque pass and a translucent one, and draws n assert.equal(translucent.renderState.depthMask, false); assert.equal(primitive.drawsBlend('translucent'), false); }); + +test('an over-depth row writes a depth of exactly 0, which a depth pick ignores', () => { + // Shaders do not compile under node: this reads the fragment shader's + // source. A depth past the near plane (as 1.0001 through + // czm_writeLogDepth was) is a surface to Cesium's depth pick, a near + // plane's distance from the camera, and the wheel stops zooming with an + // icon under the canvas centre (scripts/qa-zoom-under-icon.mjs). + const source = fs.readFileSync( + new URL('./iconSetPrimitive.js', import.meta.url), + 'utf8', + ); + const [vertex, fragment] = source + .slice(source.indexOf('const VERTEX_SHADER')) + .split('const FRAGMENT_SHADER') + .map((shader) => shader.replace(/\/\/.*$/gm, '')); // comments out + assert.match( + fragment, + /if \(v_overDepth > 0\.5\) gl_FragDepth = 0\.0;\s+else czm_writeLogDepth\(v_depthFromNearPlusOne\);/, + ); + // The vertex shader flags the row and leaves its log depth alone. + assert.match( + vertex, + /gl_Position\.z = -gl_Position\.w;[^}]*v_overDepth = 1\.0;/, + ); + assert.doesNotMatch(vertex, /v_depthFromNearPlusOne\s*=/); +}); From 0fd9a7ed573445d905ed917710a33332e7934199 Mon Sep 17 00:00:00 2001 From: Said Turksever Date: Thu, 19 Nov 2026 19:19:03 +0000 Subject: [PATCH 34/42] docs(changelog): zoom freeze under icons (#1857) --- changelog.d/1857-zoom-freeze-under-icons.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog.d/1857-zoom-freeze-under-icons.md diff --git a/changelog.d/1857-zoom-freeze-under-icons.md b/changelog.d/1857-zoom-freeze-under-icons.md new file mode 100644 index 0000000000..6816fdfa88 --- /dev/null +++ b/changelog.d/1857-zoom-freeze-under-icons.md @@ -0,0 +1,3 @@ +- Wheel and trackpad zoom no longer freeze below 150 km while an aircraft or + vessel icon is under the centre of the view: icons drawn over depth write a + depth of exactly 0, which the camera's depth pick ignores (asturksever, #1857). From 350135b8ad72b440de58f35365f83016435aefa9 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 11:20:24 -0800 Subject: [PATCH 35/42] Add the changelog entry for #1858 Co-authored-by: Manjunath Paparaju --- changelog.d/1858-kit-sweep-cockpit.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelog.d/1858-kit-sweep-cockpit.md diff --git a/changelog.d/1858-kit-sweep-cockpit.md b/changelog.d/1858-kit-sweep-cockpit.md new file mode 100644 index 0000000000..47f07f3b48 --- /dev/null +++ b/changelog.d/1858-kit-sweep-cockpit.md @@ -0,0 +1,2 @@ +- The Cockpit HUD's buttons and glyphs are now kit controls, and its rim + pointers are hidden from screen readers (manjunath22466, samehkhamis, #1858). From 648c5136a31b73545bb6fe230a12043ac1241df6 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 12:04:19 -0800 Subject: [PATCH 36/42] Fill in the pull request numbers of two changelog entries --- changelog.d/1803-shots-click-to-go-reorder.md | 2 +- changelog.d/1820-fleet-entry.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.d/1803-shots-click-to-go-reorder.md b/changelog.d/1803-shots-click-to-go-reorder.md index 427a9a5f4d..3158a3fcd4 100644 --- a/changelog.d/1803-shots-click-to-go-reorder.md +++ b/changelog.d/1803-shots-click-to-go-reorder.md @@ -1,4 +1,4 @@ - Clicking a shot row anywhere (its number, title or summary), or pressing Enter or Space on its title, now goes to the shot, as LOAD did; the LOAD button is gone. In its place, up and down arrows swap the shot with its - neighbour, saved with the project (Sameh Khamis, @samehkhamis, #XXXX). + neighbour, saved with the project (Sameh Khamis, @samehkhamis, #1803). diff --git a/changelog.d/1820-fleet-entry.md b/changelog.d/1820-fleet-entry.md index 78d09ddf22..eab448489f 100644 --- a/changelog.d/1820-fleet-entry.md +++ b/changelog.d/1820-fleet-entry.md @@ -3,4 +3,4 @@ posing, and the vessel hull sprites are part of the package's public entry points as `gods-eye-view/fleet`, with declarations, so contacts can be drawn exactly as the Flights and Vessels layers draw them (Sameh Khamis, - @samehkhamis, #XXXX). + @samehkhamis, #1820). From 8359a23e9d3e4c47078218f7458ff83d1f7b30d0 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 12:19:06 -0800 Subject: [PATCH 37/42] Vue kit: the chat panel's and voice control's buttons and glyphs are kit controls Every hand-written button in the AI chat panel (Settings, the quick prompts, an attachment's remove, Attach layer, Attach a file, Expand conversation, the command suggestions, Expand chat, Add attachment and Send / Stop reply) and in the voice control (Open AI chat, Back to chat, Back to voice, the Preview and Settings tabs and the error tray's DISMISS) is a ghost UiButton keeping its id, classes, aria and data attributes, title and listeners. The Settings and tab Material glyphs are UiIcons with :size="null", so voice-cost.css and voice-card.css still size them. The tabs keep role="tab" and aria-selected; DISMISS is a text button, so it stays a UiButton rather than a UiCloseButton. The inline SVG glyphs, the message box, the file picker and the minutes field stay as they are. src/ui/kit/chatVoiceControls.test.mjs pins it: no hand-written button or Material span in the chat, voice, voice card, panel layout and visualizer templates, kit counts per file, the pressed toggles through :pressed, the icons' :size="null", the native fields left, and no button built in script by the voice modules. docs/VUE-MIGRATION.md describes the surface. Co-authored-by: Manjunath Paparaju --- docs/VUE-MIGRATION.md | 17 +++ scripts/format-scope.json | 1 + src/ui/kit/chatVoiceControls.test.mjs | 150 ++++++++++++++++++++++++++ src/ui/views/panels/ChatPanel.vue | 22 ++-- src/ui/views/panels/VoiceControl.vue | 13 +-- 5 files changed, 187 insertions(+), 16 deletions(-) create mode 100644 src/ui/kit/chatVoiceControls.test.mjs diff --git a/docs/VUE-MIGRATION.md b/docs/VUE-MIGRATION.md index d82f798808..9a54cd9452 100644 --- a/docs/VUE-MIGRATION.md +++ b/docs/VUE-MIGRATION.md @@ -158,6 +158,23 @@ while a query is typed. The Filter button opens a disclosure and carries a `UiIcon` with `:size="null"`, so `layer-finder.css` still sizes them (`src/ui/kit/layerFinderControls.test.mjs` pins it); the search field's magnifier is `UiSearchField`'s own span. +The AI chat panel's and the voice control's buttons are ghost +`UiButton`s: the chat's Settings, quick prompts, attachment removes, +Attach layer, Attach a file, Expand conversation, command suggestions, +Expand chat, Add attachment and Send (a submit button that turns into +Stop reply), and the voice control's Open AI chat, Back to chat, Back to +voice, its Preview and Settings tabs and the error tray's DISMISS, beside +the tier button, the mic and the dock and minimize buttons, which already +were. The tier button and dock are pressed toggles; the mic is one only +while its owner has a state for it; the tabs keep `role="tab"` and +`aria-selected`. DISMISS is a text button, not a cross, so it is not a +`UiCloseButton`. The Settings and tab glyphs are `UiIcon`s with +`:size="null"`, so voice-cost.css and voice-card.css still size them +(`src/ui/kit/chatVoiceControls.test.mjs` pins it). The chat bubble, +globe, attach, send and stop, expand and Back glyphs stay inline SVG, +since no Material symbol the page loads draws them the same, and the +message box, file picker and inactivity minutes stay native fields, which +the kit has none of. The voice modules build no controls in script. `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 ebfa59916f..4f918bae17 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -1350,6 +1350,7 @@ "src/ui/kit/welcomeControls.test.mjs", "src/ui/kit/omnibarControls.test.mjs", "src/ui/kit/storiesControls.test.mjs", + "src/ui/kit/chatVoiceControls.test.mjs", "src/ui/styles/chip.css", "src/ui/styles/empty-state.css", "src/ui/rail/RailChips.vue", diff --git a/src/ui/kit/chatVoiceControls.test.mjs b/src/ui/kit/chatVoiceControls.test.mjs new file mode 100644 index 0000000000..b1716157ca --- /dev/null +++ b/src/ui/kit/chatVoiceControls.test.mjs @@ -0,0 +1,150 @@ +// The AI chat panel's and the voice control's buttons and Material glyphs +// are the kit's: neither their templates nor the voice card and panel +// layout buttons they render hand-write a +
@@ -76,7 +78,7 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];

{{ t('Explore with a question') }}

{{ t('Find a place, explore live data, or change your view.') }}

- + {{ prompt }}
{{ message.role === 'user' ? t('YOU') : ASSISTANT_NAME }}{{ message.text }} @@ -86,7 +88,7 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];

{{ props.view.chat.authNote }}

- + {{ item.name }} ×
@@ -95,27 +97,27 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')]; - + {{ t('Attach layer') }}
- + {{ t('Attach a file') }}

{{ t('TXT, Markdown, CSV, JSON or GeoJSON · up to 10 KB in total. Attachments are sent to your AI provider with your message.') }}

{{ group.label }} - + {{ command }}
- - + + - +
diff --git a/src/ui/views/panels/VoiceControl.vue b/src/ui/views/panels/VoiceControl.vue index bcbce56b87..ba7c04907f 100644 --- a/src/ui/views/panels/VoiceControl.vue +++ b/src/ui/views/panels/VoiceControl.vue @@ -11,6 +11,7 @@ import PanelLayoutButtons from './PanelLayoutButtons.vue'; import UiButton from '../../kit/UiButton.vue'; import UiCheckbox from '../../kit/UiCheckbox.vue'; import UiCloseButton from '../../kit/UiCloseButton.vue'; +import UiIcon from '../../kit/UiIcon.vue'; import UiSelect from '../../kit/UiSelect.js'; // The voice control in the command dock, as its presenter @@ -79,7 +80,7 @@ const frameStyle = (panel) => ({ {{ view.mic.text }} - + {{ t('CHAT') }} @@ -94,12 +95,12 @@ const frameStyle = (panel) => ({
- - + {{ t('Back to chat') }} + {{ t('Back to voice') }} {{ t('VOICE') }}
- - + +
@@ -158,7 +159,7 @@ const frameStyle = (panel) => ({