From b875b5f46927a5442ee7b975d88fd36fcb45a65d Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 10:39:48 -0800 Subject: [PATCH] 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( /