Vue kit: the Omnibar's mic and strip chips are UiButtons and its glyphs UiIcons

The mic is a ghost UiButton pressed with the active class, and the
suggestion strip's chips are ghost UiButtons that keep their option role
and aria-current. The search, row and chip glyphs are UiIcons sized by
the Omnibar's own rules. The mic and chat row glyphs stay inline SVG,
since no loaded Material symbol draws them. A guard test pins it.

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-19 02:29:52 -08:00
1 parent c851825119
commit be9d772b4d
4 files changed
+52 -8

No files matched your search

+8
View File
@@ -89,6 +89,14 @@ tilt-map button, whose owners still write their state into the DOM. Core's
pressable chips and pills (rail card chips, map sources, cities and places)
are `UiButton`s too; `UiChip` is a non-interactive label chip, used by
the voice card.
The 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
`:size="null"`, so its own rules still size them
(`src/ui/kit/omnibarControls.test.mjs` pins it). The mic's and the chat
row's glyphs stay inline SVG, since no Material symbol the page loads
draws them, and its field is its own combobox rather than a
`UiSearchField`.
`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
+1
View File
@@ -1343,6 +1343,7 @@
"src/ui/kit/UiDialog.vue",
"src/ui/kit/UiDialog.test.mjs",
"src/ui/kit/dialogs.test.mjs",
"src/ui/kit/omnibarControls.test.mjs",
"src/ui/styles/chip.css",
"src/ui/styles/empty-state.css",
"src/ui/rail/RailChips.vue",
+34
View File
@@ -0,0 +1,34 @@
// The Omnibar's buttons and Material glyphs are the kit's: its template
// hand-writes no <button> and no Material Symbols span. Its two inline SVG
// glyphs (the mic and the chat row's bubble) are not Material symbols the
// page loads, so they stay as they are drawn.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = readFileSync(
new URL('../views/panels/Omnibar.vue', import.meta.url),
'utf8',
);
/** The template block: everything outside script and style. */
const template = source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
test('the Omnibar hand-writes no button; each is a UiButton', () => {
assert.deepEqual(template.match(/<button\b/gi) ?? [], []);
assert.equal(template.match(/<UiButton\b/g)?.length, 2);
});
test('the Omnibar hand-writes no Material glyph; each is a UiIcon', () => {
assert.deepEqual(template.match(/material-symbols-outlined/g) ?? [], []);
assert.equal(template.match(/<UiIcon\b/g)?.length, 3);
});
test('the only inline SVG glyphs are the mic and the chat row bubble', () => {
const svgs = [...template.matchAll(/<svg\b[\s\S]*?<\/svg\s*>/g)].map(
(m) => m[0],
);
assert.equal(svgs.length, 2);
assert.match(svgs[0], /<rect x="9" y="3" width="6" height="11" rx="3" \/>/);
assert.match(svgs[1], /class="omnibar-item-icon"/);
assert.match(svgs[1], /<path d="M4 5h16v11H9l-5 4z" \/>/);
});
+9 -8
View File
@@ -16,6 +16,8 @@ import { useGlobeActionsStore } from '../../stores/globeActions.js';
import { useLocationStore } from '../../stores/location.js';
import { useOmnibarStore } from '../../stores/omnibar.js';
import { useVoiceStore } from '../../stores/voice.js';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// One field for places, layers and questions. Places run through the location
// controls, layers through the shell's omnibar actions, and anything else can
@@ -1028,7 +1030,7 @@ watch(
<section id="gev-omnibar" :class="{ 'has-results': showResults }" :aria-label="t('Search')">
<div class="omnibar-field">
<span class="omnibar-edge" aria-hidden="true"></span>
<span class="material-symbols-outlined omnibar-search-icon" aria-hidden="true">search</span>
<UiIcon class="omnibar-search-icon" name="search" :size="null" />
<input
ref="input"
id="gev-omnibar-input"
@@ -1055,9 +1057,9 @@ watch(
@blur="focused = false"
/>
<kbd class="omnibar-kbd" aria-hidden="true">{{ shortcut }}</kbd>
<button type="button" class="omnibar-mic" :class="{ active: voiceOn }" :disabled="!voice.controls" :aria-pressed="String(voiceOn)" :aria-label="t('Talk to GEV')" :title="t('Talk to GEV')" @click="onMic(true)">
<UiButton class="omnibar-mic" :pressed="voiceOn" pressed-class="active" :disabled="!voice.controls" :label="t('Talk to GEV')" @click="onMic(true)">
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><rect x="9" y="3" width="6" height="11" rx="3" /><path d="M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21" /></svg>
</button>
</UiButton>
</div>
<div v-show="showResults" ref="results" class="omnibar-results" :class="{ 'has-feedback': showFeedback }">
<p id="omnibar-error" v-show="showFeedback" role="alert">{{ feedback }}</p>
@@ -1065,11 +1067,10 @@ watch(
<li v-if="strip" class="omnibar-strip" role="group" :aria-label="strip.title">
<span class="omnibar-strip__title" aria-hidden="true">{{ strip.title }}</span>
<div ref="stripChips" class="omnibar-strip__chips" role="presentation" @wheel="onStripWheel">
<button
<UiButton
v-for="(chip, index) in strip.chips"
:id="`gev-omnibar-chip-${index}`"
:key="chip.key"
type="button"
tabindex="-1"
class="omnibar-strip__chip"
:class="{ active: chip.pressed, focused: inStrip && index === chipIndex }"
@@ -1079,8 +1080,8 @@ watch(
@mousedown.prevent
@click="chooseChip(chip)"
>
<span class="material-symbols-outlined" aria-hidden="true">{{ chip.icon }}</span>{{ chip.name }}
</button>
<UiIcon :name="chip.icon" :size="null" />{{ chip.name }}
</UiButton>
</div>
</li>
<li
@@ -1095,7 +1096,7 @@ watch(
@click="choose(item)"
@mousemove="inStrip = false"
>
<span v-if="item.icon" class="material-symbols-outlined omnibar-item-icon" aria-hidden="true">{{ item.icon }}</span>
<UiIcon v-if="item.icon" class="omnibar-item-icon" :name="item.icon" :size="null" />
<svg v-else class="omnibar-item-icon" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path d="M4 5h16v11H9l-5 4z" /></svg>
<span class="omnibar-item-label">{{ item.label }}</span>
<small>{{ item.hint }}</small>