Vue kit: the docs' every-control claims hold, and a scan of every view pins them

docs/VUE-MIGRATION.md says every select is a UiSelect, every close button
a UiCloseButton and (nearly) every pressed toggle a UiButton. Make those
true in code, correct the sentences that were not, and pin them.

Selects: Story Explore's sort, the chat's layer picker and a layer row's
range ends are UiSelects. The range ends take `hold`, since the layer
panel repaints the row on a later frame.

Close buttons: the space mission replay's Cancel is a bare UiCloseButton.
An imported file's row actions (show or hide, fly to, remove) are icon
UiButtons drawing the icon the file import names, so Remove stays one of
them; the presenter's `pressed` is now a boolean.

Pressed toggles: the tilt-map button, the scene action buttons, the chat
and voice panels' dock (and its minimize), the Context header's search
and expand, Recent Imagery's day chips, SWAP and ZOOM IN, the rail row
lists and the rail cards' action chips are UiButtons with `pressed` (and
`pressed-class="active"` where their active class came from the same
state). Their Material glyphs, and the rail chips' icons, are UiIcons
with `:size="null"`. Bhote Koshi's cinematic button keeps the attributes
its layer writes, and Explore's story cards stay role="button" elements.

Docs: the kit list gains UiPanelToggle and UiPanelEdge; the pressed-toggle,
chips, Stories search fields, role="dialog", close button, range and
source-reading-tests sentences now say what the code does.

Tests: src/ui/kit/viewControls.test.mjs walks every .vue outside the kit
and fails on a raw select, a hand-written aria-pressed on a button,
UiButton or role="button" element (outside the two documented
exceptions), or a hand-written close glyph button. closeButtons.test.mjs
also catches a × inside a span.

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-19 07:56:34 -08:00
1 parent 5dbd73b4e9
commit 1e70e15ceb
25 files changed
+381 -116

No files matched your search

+7 -6
View File
@@ -17,6 +17,7 @@ import ViewContext from './panels/ViewContext.vue';
import SpaceMissionsPanel from './panels/SpaceMissionsPanel.vue';
import RadioPanel from './panels/RadioPanel.vue';
import UiButton from '../kit/UiButton.vue';
import UiIcon from '../kit/UiIcon.vue';
import UiSearchField from '../kit/UiSearchField.vue';
import { cockpitEntryFace } from '../cockpitPresentation.js';
import { LAYER_TABS, TAB_AFFECTS, activeTab, availableTabs, contextReady, enabledLayerIds, setEnabledLayers, tabTarget } from '../contextLayerTabs.js';
@@ -182,12 +183,12 @@ watch(
</RailPanel>
<RailPanel id="global-context-panel" start-collapsed v-class-toggle="{ ...(ctx && { 'context-enabled': ctx.enabled }) }" :data-context-mode="ctx?.mode" :data-context-tab="activeTab" :title="t('CONTEXT')" sideways scroll rail-scroller>
<template #actions>
<button type="button" class="context-dock-btn" :aria-pressed="String(contextSearchOpen)" :aria-label="contextSearchOpen ? t('Close Context search') : t('Search in Context')" :title="contextSearchOpen ? t('Close search') : t('Search in Context')" @click="toggleSearch">
<span class="material-symbols-outlined" aria-hidden="true">search</span>
</button>
<button type="button" class="context-dock-btn" :aria-pressed="String(docked)" :aria-label="docked ? t('Shrink Context back to a panel') : t('Expand Context to a full-height column')" :title="docked ? t('Shrink') : t('Expand')" @click="setDocked(!docked)">
<span class="material-symbols-outlined" aria-hidden="true">{{ docked ? 'close_fullscreen' : 'open_in_full' }}</span>
</button>
<UiButton class="context-dock-btn" :pressed="Boolean(contextSearchOpen)" :aria-label="contextSearchOpen ? t('Close Context search') : t('Search in Context')" :title="contextSearchOpen ? t('Close search') : t('Search in Context')" @click="toggleSearch">
<UiIcon name="search" :size="null" />
</UiButton>
<UiButton class="context-dock-btn" :pressed="docked" :aria-label="docked ? t('Shrink Context back to a panel') : t('Expand Context to a full-height column')" :title="docked ? t('Shrink') : t('Expand')" @click="setDocked(!docked)">
<UiIcon :name="docked ? 'close_fullscreen' : 'open_in_full'" :size="null" />
</UiButton>
</template>
<div class="cyber-panel-body ui-scroll" data-rail-scroller>
<UiSearchField v-if="contextSearchOpen" ref="searchInput" v-model="contextSearchText" class="context-search" role="search" input-class="context-search__input" :label="searchHint" :placeholder="searchHint" autocomplete="off" spellcheck="false" :clear-label="t('Clear search')" clear-class="context-search__clear" @escape="closeContextSearch" />
+3 -4
View File
@@ -6,6 +6,7 @@ import { useVoiceStore } from '../../stores/voice.js';
import { ASSISTANT_NAME } from '../../../voice/control.js';
import PanelLayoutButtons from './PanelLayoutButtons.vue';
import UiCloseButton from '../../kit/UiCloseButton.vue';
import UiSelect from '../../kit/UiSelect.js';
// The typed chat in the command dock, as its owner (src/voice/chatControl.js)
// writes the voice control presenter. Messages arrive apart from the view, so
@@ -15,7 +16,6 @@ const store = useVoiceStore();
const { controls, chat: messages } = storeToRefs(store);
const emit = (name, ...args) => controls.value?.emit(name, ...args);
const list = ref(null);
const layerSelect = ref(null);
const layerChoice = ref('');
// The input holds what the person types until its owner writes it (history
@@ -55,7 +55,6 @@ watch(messages, (next, previous) => {
function attachLayer() {
const value = layerChoice.value;
layerChoice.value = '';
if (layerSelect.value) layerSelect.value.value = '';
if (value) emit('chat-layer', value);
}
@@ -92,10 +91,10 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
<div id="gev-chat-attach-menu" :hidden="!props.view.chat.attachMenuOpen" @keydown="emit('chat-attach-keydown', $event)">
<label for="gev-chat-layer">{{ t('Attach a map layer') }}</label>
<div id="gev-chat-layer-row">
<select id="gev-chat-layer" ref="layerSelect" :disabled="props.view.chat.locked" @change="layerChoice = $event.target.value" @keydown.enter.prevent="attachLayer()">
<UiSelect id="gev-chat-layer" v-model="layerChoice" :disabled="props.view.chat.locked" @keydown.enter.prevent="attachLayer()">
<option value="">{{ t('Choose a layer…') }}</option>
<option v-for="layer in props.view.chat.layers" :key="layer.value" :value="layer.value">{{ layer.label }}</option>
</select>
</UiSelect>
<button id="gev-chat-layer-attach" type="button" :disabled="props.view.chat.locked || !layerChoice" @click="attachLayer()">{{ t('Attach layer') }}</button>
</div>
<button id="gev-chat-file-button" type="button" :disabled="props.view.chat.locked" @click="emit('chat-file-button')">{{ t('Attach a file') }}</button>
+7 -3
View File
@@ -4,13 +4,17 @@ import { computed, ref } from 'vue';
import { t } from '../../../i18n/index.js';
import { vFocusSafeChildren } from '../../rail/focusSafeChildren.js';
import { useDisplayStore } from '../../stores/display.js';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// DISPLAY ▸ Import: the button, the hidden picker, the imported files and
// the hint. The file import publishes the rows and hint; until it does, the
// list is empty. A pick and the row buttons call its actions. Before the
// row holding keyboard focus goes, focus moves to the next row's same
// button, else the previous row's, else the Import button. The list's
// template is one line: templates keep whitespace.
// button, else the previous row's, else the Import button. Each row's
// actions (show or hide, fly to, remove) are icon buttons the file import
// describes, Show/Hide a pressed toggle. The list's template is one line:
// templates keep whitespace.
const display = useDisplayStore();
const { geoImport } = storeToRefs(display);
const rows = computed(() => geoImport.value?.rows ?? []);
@@ -63,7 +67,7 @@ function leave() {
<span class="pp-label">{{ t('Import') }}</span>
</button>
<input ref="picker" type="file" id="geo-import-input" accept=".geojson,.json,.kml,.kmz,.gpx" multiple hidden @change="pick" :aria-label="t('Choose GeoJSON, KML, KMZ or GPX files')">
<ul class="geo-import-list" :class="{ visible: listed }" id="geo-import-list" v-focus-safe-children="leave" :aria-label="t('Imported files')"><li v-for="row in rows" :key="row.id" class="geo-import-row" :data-import-id="row.id"><span :class="['geo-import-swatch', { 'own-styles': row.ownStyles }]" :style="row.ownStyles ? null : { background: row.color }"></span><span class="geo-import-name" :title="row.title">{{ row.name }}</span><button v-for="item in row.actions" :key="item.action" type="button" class="geo-import-action" :data-action="item.action" :title="item.label" :aria-label="item.label" :aria-pressed="item.pressed" @click="display.act(ROW_ACTIONS[item.action], row.id)"><span class="material-symbols-outlined" aria-hidden="true">{{ item.icon }}</span></button></li></ul>
<ul class="geo-import-list" :class="{ visible: listed }" id="geo-import-list" v-focus-safe-children="leave" :aria-label="t('Imported files')"><li v-for="row in rows" :key="row.id" class="geo-import-row" :data-import-id="row.id"><span :class="['geo-import-swatch', { 'own-styles': row.ownStyles }]" :style="row.ownStyles ? null : { background: row.color }"></span><span class="geo-import-name" :title="row.title">{{ row.name }}</span><UiButton v-for="item in row.actions" :key="item.action" class="geo-import-action" :data-action="item.action" :label="item.label" :pressed="item.pressed" @click="display.act(ROW_ACTIONS[item.action], row.id)"><UiIcon :name="item.icon" :size="null" /></UiButton></li></ul>
<span class="draw-hint geo-import-hint" id="geo-import-hint" aria-live="polite">{{ geoImport?.hint ?? '' }}</span>
</div>
</template>
+5 -3
View File
@@ -4,6 +4,8 @@ import { computed } from 'vue';
import { t } from '../../../i18n/index.js';
import { useGlobeActionsStore } from '../../stores/globeActions.js';
import GlobeCompass from './GlobeCompass.vue';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// The top-center camera and share actions. The shell answers the buttons
// through the store and publishes a clear under way, which keeps the button
@@ -24,9 +26,9 @@ const tilted = computed(() => Boolean(camera.value?.tilted));
<button id="share-btn" type="button" :aria-label="t('Copy share link')" :title="t('Copy share link')" @click="act('share')">
<span class="share-icon" aria-hidden="true">&#x1F517;</span>
</button>
<button id="tilt-map-view" type="button" :aria-label="tilted ? t('Return map to straight-down view') : t('Tilt map to oblique view')" :aria-pressed="String(tilted)" :title="t('Toggle straight-down and tilted map views')" @click="act('tilt')">
<span class="material-symbols-outlined" aria-hidden="true">view_in_ar</span>
</button>
<UiButton id="tilt-map-view" :aria-label="tilted ? t('Return map to straight-down view') : t('Tilt map to oblique view')" :pressed="tilted" :title="t('Toggle straight-down and tilted map views')" @click="act('tilt')">
<UiIcon name="view_in_ar" :size="null" />
</UiButton>
<GlobeCompass @click="act('northUp')" />
<button id="reset-globe-view" type="button" :aria-label="resetBusy ? t('Resetting to full globe view') : t('Reset to full globe view')" :title="t('Reset camera and return to full globe view')" @click="act('reset')">
<span class="material-symbols-outlined" aria-hidden="true">public</span>
+1 -1
View File
@@ -72,7 +72,7 @@ watch(
<UiButton class="mission-replay-button" data-mission-replay :pressed="m?.replay.active ?? false" :title="t('Replay the estimated ascent with a following camera')" :hidden="m && (m.replay.active || !m.replay.available)" :disabled="m && !m.replay.available" @click="layer?.startSelectedReplay()">{{ t('REPLAY ASCENT') }}</UiButton>
<div class="mission-replay-transport" :class="{ 'is-paused': m?.replay.paused }" data-mission-replay-transport :hidden="!m?.replay.active" :aria-label="m?.replay.transportLabel">
<button type="button" data-mission-replay-toggle :title="m ? m.replay.toggleLabel : t('Pause replay')" :aria-label="m ? m.replay.toggleLabel : t('Pause replay')" :disabled="m && !m.replay.active" @click="layer?.toggleReplayPause()">{{ m ? m.replay.toggleText : 'Ⅱ' }}</button>
<button type="button" class="cancel" data-mission-replay-cancel :title="t('Cancel replay')" :aria-label="t('Cancel replay')" @click="layer?.cancelReplay()"><span aria-hidden="true">×</span></button>
<UiCloseButton class="cancel" data-mission-replay-cancel bare :title="t('Cancel replay')" :label="t('Cancel replay')" @click="layer?.cancelReplay()" />
</div>
</div>
<div class="space-mission-nav">
+3 -2
View File
@@ -1,5 +1,6 @@
<script setup>
import { t } from '../../../i18n/index.js';
import UiButton from '../../kit/UiButton.vue';
// Dock and minimize for an assistant panel (chat or voice). The owner
// (src/voice/panelLayout.js) places the panel; this reports the choice.
@@ -12,7 +13,7 @@ defineEmits(['dock', 'minimize']);
<template>
<div class="gev-panel-layout" role="group" :aria-label="t('Panel position')">
<button type="button" data-layout-dock :aria-pressed="String(props.docked)" :aria-label="props.docked ? t('Move above the dock') : t('Dock to the right')" :title="props.docked ? t('Move above the dock') : t('Dock to the right')" @click="$emit('dock')"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path :d="props.docked ? 'M4 5h16v14H4ZM4 14h16' : 'M4 5h16v14H4ZM14 5v14'"></path></svg></button>
<button type="button" data-layout-minimize :aria-label="props.minimized ? t('Expand panel') : t('Minimize panel')" :title="props.minimized ? t('Expand panel') : t('Minimize panel')" @click="$emit('minimize')"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path :d="props.minimized ? 'M6 6h12v12H6Z' : 'M6 12h12'"></path></svg></button>
<UiButton data-layout-dock :pressed="props.docked" :label="props.docked ? t('Move above the dock') : t('Dock to the right')" @click="$emit('dock')"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path :d="props.docked ? 'M4 5h16v14H4ZM4 14h16' : 'M4 5h16v14H4ZM14 5v14'"></path></svg></UiButton>
<UiButton data-layout-minimize :label="props.minimized ? t('Expand panel') : t('Minimize panel')" @click="$emit('minimize')"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path :d="props.minimized ? 'M6 6h12v12H6Z' : 'M6 12h12'"></path></svg></UiButton>
</div>
</template>
+2 -1
View File
@@ -2,6 +2,7 @@
import { storeToRefs } from 'pinia';
import { t } from '../../../i18n/index.js';
import { useSceneInteractionsStore } from '../../stores/sceneInteractions.js';
import UiButton from '../../kit/UiButton.vue';
// The active shot's Scene actions panel, inside the viewer's container, as
// the scene interactions owner (src/scenes/interactions.js) presents it.
@@ -45,6 +46,6 @@ const outline = (id) => ({
<template>
<Teleport v-if="panel" :to="panel.container">
<section :key="panel.id" data-director-interactions="" :aria-label="t('Scene actions')" :style="panelStyle"><strong>{{ t('Scene actions') }}</strong><p role="status">{{ panel.status }}</p><button v-for="item in panel.items" :key="item.id" type="button" :data-director-action="item.id" :disabled="panel.busy" :aria-pressed="String(panel.selected === item.id)" :style="outline(item.id)" :onClick="onClick(panel.owner, item.id)">{{ item.label }}</button><div data-director-action-card=""><template v-if="panel.card"><p>{{ panel.card.text }}</p><a v-if="panel.card.url" :href="panel.card.url" target="_blank" rel="noopener noreferrer" style="color: #6eeaff">{{ t('Source') }}</a></template></div></section>
<section :key="panel.id" data-director-interactions="" :aria-label="t('Scene actions')" :style="panelStyle"><strong>{{ t('Scene actions') }}</strong><p role="status">{{ panel.status }}</p><UiButton v-for="item in panel.items" :key="item.id" :data-director-action="item.id" :disabled="panel.busy" :pressed="panel.selected === item.id" :style="outline(item.id)" :onClick="onClick(panel.owner, item.id)">{{ item.label }}</UiButton><div data-director-action-card=""><template v-if="panel.card"><p>{{ panel.card.text }}</p><a v-if="panel.card.url" :href="panel.card.url" target="_blank" rel="noopener noreferrer" style="color: #6eeaff">{{ t('Source') }}</a></template></div></section>
</Teleport>
</template>
+3 -2
View File
@@ -23,6 +23,7 @@ import {
import StoriesHeader from './StoriesHeader.vue';
import UiButton from '../../kit/UiButton.vue';
import UiCheckbox from '../../kit/UiCheckbox.vue';
import UiSelect from '../../kit/UiSelect.js';
/**
* Explore (prototype `.scr-explore`): the feed beside GEV's Cesium globe,
@@ -446,11 +447,11 @@ defineExpose({
>
<div class="fh-tools">
<label class="sr" for="exSort">{{ t('Sort stories') }}</label>
<select id="exSort" v-model="sort" class="fh-sort">
<UiSelect id="exSort" v-model="sort" class="fh-sort">
<option value="new">{{ t('Newest') }}</option>
<option value="long">{{ t('Longest') }}</option>
<option value="az">{{ t('A–Z') }}</option>
</select>
</UiSelect>
<UiButton
id="exFilterBtn"
ref="filterBtn"