fix(cockpit): C stays the CCTV shortcut when the bridge cannot be entered

With a vessel selected and no aircraft tracked, Cockpit took C and stopped
it even when the bridge gate was shut, so the key did nothing and CCTV no
longer toggled. C is now taken only when the bridge can be entered.

The arrow keys also stay with comboboxes, spinbuttons, trees, grids,
menubars, scrollbars and text boxes on a bridge, which move with them.
This commit is contained in:
Sameh Khamis committed 2026-11-08 14:09:17 -08:00
1 parent d55acd2ac5
commit b98bc4b0dc
2 files changed
+40 -3

No files matched your search

+21
View File
@@ -439,6 +439,27 @@ test('C enters the selected vessel bridge and aircraft-only entry refuses it', a
assert.equal(event.defaultPrevented, true);
});
test('C stays the CCTV shortcut when the bridge gate is shut', async (t) => {
const { cockpit } = fixture(t, { bridgeAllowed: false });
let stopped = false;
const event = {
key: 'c',
target: document.body,
defaultPrevented: false,
preventDefault() {
this.defaultPrevented = true;
},
stopImmediatePropagation() {
stopped = true;
},
};
cockpit.onKeyDown(event);
await settle();
assert.equal(cockpit.active, false);
assert.equal(event.defaultPrevented, false);
assert.equal(stopped, false, 'the application shortcut still sees C');
});
test('a slow-frame bridge keeps pace with its ship', async (t) => {
// One rendered frame a second, as software rendering manages. The bridge
// must still cover the ship's distance, not a capped fraction of it.