fix(location): a POI key held with Cmd, Ctrl or Alt runs no POI

The points-of-interest keys (Q/W/E/R/T while a city is expanded) are a
second bare-key document listener, and it did not look at modifiers
either: Alt+R or a delivered Ctrl+R picked the fourth POI and flew the
camera there. It now leaves Cmd, Ctrl and Alt chords to the browser like
the application shortcuts; Shift still counts as the key. The docs and
the changelog entry say so.
This commit is contained in:
Sameh Khamis committed 2026-11-12 18:02:41 -08:00
1 parent 8ac0d95f1b
commit 1d476c87ee
4 files changed
+17 -1

No files matched your search

@@ -1,4 +1,5 @@
- Leave browser and system chords alone: a shortcut key held with Cmd, Ctrl or
Alt no longer runs its single-key shortcut. Copying with Cmd+C or Ctrl+C used
to turn the CCTV layer on and open the nearest camera, Cmd+F opened the layers
panel and Cmd+1 to 6 changed the visual style (asturksever, #1691).
panel and Cmd+1 to 6 changed the visual style. The Q/W/E/R/T keys of an
expanded city's points of interest follow the same rule (asturksever, #1691).
+2
View File
@@ -2329,6 +2329,8 @@ typing and Escape behavior retain their existing mappings. 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.
The Q/W/E/R/T keys of an expanded city's points of interest follow the same
rule.
Capture-phase surfaces continue to arbitrate their own keyboard events first.
The UI facade retains shader values, share-restore authority, render requests,
+3
View File
@@ -88,6 +88,9 @@ export class LocationControls {
event.target === elements.search
)
return;
// As for the application shortcuts: Cmd+R, Ctrl+W, Alt+E and the like
// belong to the browser and the system. Shift is not a chord.
if (event.metaKey || event.ctrlKey || event.altKey) return;
const index = POI_KEYS.indexOf(event.key.toUpperCase());
if (index !== -1 && index < (cities[cityId]?.pois.length || 0))
onPoi(cityId, index);
+10
View File
@@ -191,6 +191,16 @@ test('location and POI keys route once while form controls retain typing', () =>
f.controls.reset();
assert.deepEqual(f.calls, [['poi', 'a', 1], ['reset']]);
});
test('POI keys held with Cmd, Ctrl or Alt run no POI; Shift still does', () => {
const f = fixture();
const target = { matches: () => false };
for (const modifier of ['metaKey', 'ctrlKey', 'altKey'])
for (const key of ['q', 'w', 'r', 'R'])
f.doc.fire('keydown', { key, target, [modifier]: true });
assert.deepEqual(f.calls, []);
f.doc.fire('keydown', { key: 'W', target, shiftKey: true });
assert.deepEqual(f.calls, [['poi', 'a', 1]]);
});
test('typing clears a failed search error and closing the emptied field drops it too', () => {
const f = fixture();
f.elements.search.value = 'Pariss';