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

+19 -3
View File
@@ -141,7 +141,18 @@ const LOOK_KEY_OWNERS = [
'textarea',
'select',
'[contenteditable]',
'[role=combobox]',
'[role=grid]',
'[role=menubar]',
'[role=menuitemcheckbox]',
'[role=menuitemradio]',
'[role=scrollbar]',
'[role=searchbox]',
'[role=slider]',
'[role=spinbutton]',
'[role=textbox]',
'[role=tree]',
'[role=treeitem]',
'[role=tab]',
'[role=tablist]',
'[role=radio]',
@@ -231,13 +242,18 @@ export function onKeyDown(event) {
const cockpitAttempt = !!(
this.readAircraftInfo() && this.viewer.trackedEntity?.position
);
// With no tracked aircraft, C takes the selected vessel's bridge.
const bridgeAttempt = !cockpitAttempt && !!this.readVesselInfo();
// With no tracked aircraft, C takes the selected vessel's bridge, but
// only when the bridge can be entered: otherwise C stays the CCTV
// shortcut, as it is with nothing selected.
const bridgeAttempt =
!cockpitAttempt &&
!!this.readVesselInfo() &&
this.isBridgeEntryAllowed();
if (!cockpitAttempt && !bridgeAttempt) return;
if (bridgeAttempt) {
event.preventDefault();
event.stopImmediatePropagation();
if (this.isBridgeEntryAllowed()) this.enter({ kind: 'vessel' });
this.enter({ kind: 'vessel' });
return;
}
}