Fix the search bar's stale errors, hidden-field shortcuts and repeated Enter

From review:
- An error goes when a chip is chosen, and a search's error shows only
  under the line it was for: a lookup that fails after the line was edited
  says nothing under the new text.
- With voice on the field is hidden: "/" and Cmd/Ctrl+K no longer focus
  it, and nothing is looked up for it.
- Without the action runner a refused or cancelled search keeps the line,
  as the plan path does (only true is success).
- Text an input method is still composing is read when it is committed.
- A held or repeated Enter does not restart the same line over its flight.
- A city chip for the city whose landmarks are open flies there instead
  of folding the landmarks.
- "villages around here" is looked up again for the current view.
- Data Layers takes the full lane only where the desktop dock is laid out,
  by the condition omnibar-dock.css uses.
- On short phones the HUD readout moves under the field it shared a row
  with.
- CURRENT-STATE says the phone gains a field and which places are kept.

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-18 15:00:07 -08:00
1 parent 24731951a0
commit d7f10e4d2a
4 files changed
+70 -11

No files matched your search

+4 -3
View File
@@ -7817,8 +7817,8 @@ and unreachable upstream (502/504) separately from road geometry.
### Omnibar
The desktop Omnibar sits above the footer with the existing mic and chat
buttons on either side. Suggestions open upward; the phone field stays at
the top and opens downward. While voice is on, the desktop field shows
buttons on either side. Suggestions open upward. On phones the Omnibar is
a field near the top, beside the Search sheet, and opens downward. While voice is on, the desktop field shows
three audio traces in place of the search text and icon. The thinking dots
sit on the field's top edge. World Time appears immediately above the dock
and hides while suggestions, chat, or voice settings are visible. `/`
@@ -8088,7 +8088,8 @@ recovery or seed phrases, "my secret is …" and an email spelled out ("john
at example dot com") are private too. Text that parses as coordinates or a
grid reference is not private. A place's name is six words at most, or ten
when it has a number in it (an address: "1600 Pennsylvania Ave NW
Washington DC 20500"). The places you go to from the Omnibar (the last 20:
Washington DC 20500"). The places picked from the Omnibar's rows and chips that carry a position
(a typed name searched as a place, or a plan's place, is not kept; the last 20:
name, position and where the name came from) are kept in this browser's
`localStorage` under `gev:omnibar:recent-places` for the strip; nothing
clears them but the browser's own site data. Setting `PHOTON_URL`
+22 -1
View File
@@ -7,6 +7,27 @@ import {
import { measurePanelNaturalHeight } from './panelMeasurement.js';
import { settleSideAccordion } from './panelAccordion.js';
/**
* Whether the desktop Omnibar dock is laid out, by the condition
* omnibar-dock.css lays it out by: the bar and the voice control in the
* dock, outside the phone layout, the cockpit, playback, clean view and
* recording.
*/
const DOCK_OFF = [
'mobile-shell',
'cockpit-mode',
'scene-playback-mode',
'ui-clean-view',
'recording-mode',
];
function desktopOmnibarDock(documentRef) {
if (!documentRef?.getElementById?.('gev-omnibar')) return false;
const body = documentRef.body;
if (DOCK_OFF.some((name) => body?.classList?.contains?.(name))) return false;
const voice = documentRef.getElementById('gev-voice-control');
return Boolean(voice) && voice.parentElement?.id === 'command-dock';
}
/**
* Measure and place the left panel rail for one synchronous layout pass.
* The caller owns scheduling, obstacle selection, disclosure preferences and
@@ -233,7 +254,7 @@ export function layoutLeftPanelRail({
exclusive &&
expandedPanels.length === 1 &&
expandedPanels[0].id === 'data-panel' &&
Boolean(documentRef?.getElementById?.('gev-omnibar'));
desktopOmnibarDock(documentRef);
const shouldTail =
!fillDataLayers &&
expandedPanels.length > 0 &&
+6 -1
View File
@@ -250,8 +250,13 @@ test('a centered timeline only shortens the corridor when it reaches the visible
test('Data Layers extends to the HUD even if its list is currently short', () => {
const f = fixture('left');
f.first.id = 'data-panel';
const dock = { id: 'command-dock' };
f.options.documentRef.getElementById = (id) =>
id === 'gev-omnibar' ? {} : null;
id === 'gev-omnibar'
? {}
: id === 'gev-voice-control'
? { parentElement: dock }
: null;
f.expand(f.first, 250);
f.options.obstacles = [element('hud', { top: 760, height: 45 })];
f.run();
+38 -6
View File
@@ -53,7 +53,12 @@ const error = ref('');
const busy = ref(false);
let generation = 0;
let stopGuide;
const searchError = computed(() => locationView.value?.searchOrigin === 'omnibar' ? locationView.value.searchError : '');
// A search's error shows under the line it was for: one that fails after
// the line was edited says nothing under the new text.
const searchedFor = ref(null);
const searchError = computed(() =>
locationView.value?.searchOrigin === 'omnibar' && searchedFor.value === query.value ? locationView.value.searchError : '',
);
const feedback = computed(() => error.value || searchError.value);
const voiceOn = computed(() => voice.view?.root?.assistantMode === 'voice');
// Voice taking over supersedes whatever the field was still running: a plan
@@ -133,7 +138,8 @@ watch(query, (value) => {
// Only text that may name a place goes to the place service, and only the
// part that names it: never private text, a question, a sentence, a
// command, a switch, coordinates or an aircraft code (see placeQuery).
const asked = suggester.enabled ? reader.value.placeQuery(text) : null;
// Nothing is looked up for a field hidden under voice.
const asked = suggester.enabled && !voiceOn.value ? reader.value.placeQuery(text) : null;
if (!asked) {
places.value = [];
placesFor.value = '';
@@ -381,6 +387,7 @@ async function goTo({ latitude, longitude }) {
if (runner.value) return settled(await runner.value('fly_to_location', { latitude, longitude }));
const location = locationStore.controls;
if (!location || location.destroyed) throw new Error();
searchedFor.value = query.value;
await location.search(`${latitude}, ${longitude}`);
return true;
}
@@ -389,6 +396,9 @@ function chooseChip(chip, { viaKey = false } = {}) {
if (screenIsOwned()) return;
generation++;
busy.value = false;
// A chip is a new request: the last one's error goes.
error.value = '';
locationStore.controls?.editSearch();
if (chip.kind === 'entity') {
entityCard.select(chip.identity, { fly: true });
reset({ blur: !keepsFocus(viaKey) });
@@ -406,7 +416,10 @@ function chooseChip(chip, { viaKey = false } = {}) {
reset();
return;
}
if (chip.kind === 'city') locationStore.controls?.chooseCity(chip.cityId);
// The city whose landmarks are open would only fold them: it is flown to.
if (chip.kind === 'city' && locationView.value?.poiCity === chip.cityId && runner.value)
void runner.value('fly_to_location', { locationId: chip.cityId });
else if (chip.kind === 'city') locationStore.controls?.chooseCity(chip.cityId);
else if (chip.kind === 'landmark') {
if (locationView.value?.poiCity === chip.cityId) locationStore.controls?.choosePoi(chip.index);
else {
@@ -563,7 +576,10 @@ watch(
() => (focused.value ? villagesAsked.value : ''),
(asked) => {
clearTimeout(villagesTimer);
if (!asked || villages.value?.asked === asked) return;
// "around here" and "near it" move with the view and the selection, so
// they are looked up again; a named place is the same place.
const relative = HERE.test(asked) || /^(me|it|this|that)$/i.test(asked);
if (!asked || (villages.value?.asked === asked && !relative)) return;
villagesTimer = setTimeout(() => void findVillages(asked), 250);
},
);
@@ -628,6 +644,9 @@ const showFeedback = computed(() => feedback.value && (focused.value || !assista
const showResults = computed(() => open.value || showFeedback.value || noCommand.value || privateNote.value);
function onInput(event) {
// Text an input method is still composing is read when it is committed
// (compositionend), not sent to the place service half-written.
if (event.isComposing) return;
query.value = event.target.value;
generation++;
busy.value = false;
@@ -739,6 +758,7 @@ async function runPlan(steps, current) {
// the plan go on; a cancelled, missing or failed one stops it.
const location = locationStore.controls;
if (!location || location.destroyed) throw new Error();
searchedFor.value = query.value;
const flight = await location.search(step.place);
if (flight !== true) return;
}
@@ -829,8 +849,11 @@ async function choose(item, { viaKey = false } = {}) {
} else {
const location = locationStore.controls;
if (!location || location.destroyed) throw new Error();
searchedFor.value = query.value;
const result = await location.search(coords ? `${coords.latitude}, ${coords.longitude}` : place);
if (result === false || locationView.value?.searchOrigin !== 'omnibar' || searchError.value) return;
// Only a search that found the place counts: a refused or cancelled
// one (undefined) keeps the line, as the plan path does.
if (result !== true || locationView.value?.searchOrigin !== 'omnibar' || searchError.value) return;
}
// A typed spot is the user's own; a looked-up place keeps its source.
if (coords && item.kind === 'place') rememberPlace({ name: place, ...coords, source: item.source || 'typed' });
@@ -932,6 +955,9 @@ function onKeydown(event) {
} else if (event.key === 'Enter') {
if (!open.value) return;
event.preventDefault();
// A held or repeated Enter does not start the same line again over its
// flight; an edited line (which clears busy) runs.
if (event.repeat || busy.value) return;
if (inStrip.value && chips[chipIndex.value]) chooseChip(chips[chipIndex.value], { viaKey: true });
else choose(items.value[active.value], { viaKey: true });
} else if (event.key === 'Escape' && !showResults.value && !query.value.trim()) {
@@ -952,7 +978,8 @@ function onKeydown(event) {
// focuses the field. Ctrl+K on a Mac is left to the text field it is in.
const isMac = /Mac|iPhone|iPad/.test(globalThis.navigator?.platform || '');
function onGlobalKeydown(event) {
if (event.defaultPrevented || event.isComposing || screenIsOwned() || !input.value?.getClientRects().length) return;
// With voice on the field is hidden: the shortcut does not focus it.
if (event.defaultPrevented || event.isComposing || voiceOn.value || screenIsOwned() || !input.value?.getClientRects().length) return;
// An open modal dialog, or focus inside any dialog (the guide), keeps its
// keys: the shortcut does not pull focus out of it.
const doc = globalThis.document;
@@ -1026,6 +1053,7 @@ watch(
:placeholder="t('Search places, layers, flights… or ask GEV · > for commands')"
:value="query"
@input="onInput"
@compositionend="onInput"
@keydown="onKeydown"
@focus="focused = true; dismissed = false; navigated = false; inStrip = false; layerRevision++"
@blur="focused = false"
@@ -1338,6 +1366,10 @@ small {
--omnibar-message-padding: 1px;
--omnibar-item-padding: 2px;
}
/* The field takes the HUD readout's row (48-82px): the readout sits under it. */
:global(body.mobile-shell:has(#world-timeline):has(#gev-omnibar) #intel-hud .hud-bottom-left) {
top: calc(var(--mobile-top-inset, 0px) + 88px);
}
}
:global(body.ui-clean-view #gev-omnibar),
:global(body.recording-mode #gev-omnibar),