Skip to content

fix: stabilize native Cmd-K and Escape bridge - #61

Merged
daniele21 merged 2 commits into
devfrom
prs18/stabilize-native-shortcuts
Sep 15, 2026
Merged

daniele21 merged 2 commits into
devfrom
prs18/stabilize-native-shortcuts

Conversation

@daniele21

Copy link
Copy Markdown
Owner

Outcome

Remove the activation/key-window race from the native AppKit -> WKWebView keyboard bridge while preserving the existing frontend and REAL_ENVIRONMENT contracts.

Physical evidence

On exact candidate 588fcc7ed67afe1ec64398be1c618821b02272b1, the same immutable artifact produced inconsistent shortcut outcomes across representative-Mac runs:

  • measured journey: keyboard_cmd_k_search failed;
  • contention seed journey: Cmd-K passed, focus reached AXTextField, Escape failed;
  • isolated diagnostic: Cmd-K failed, AX Search opened the same dialog, Escape then passed.

Search UI, AX activation, recording, persistence and dual-source capture remained healthy. This isolates the remaining issue to an intermittent synthetic key-delivery boundary rather than deterministic React/Radix behavior.

Root cause addressed

PR #60 gated the app-local NSEvent monitor on self.window.isKeyWindow(). The helper activates ClosedRoom and immediately posts a CGEvent to the PID, so the event can reach the app before the NSWindow key transition has settled. That makes the bridge timing-dependent.

Cmd-K recognition also relied only on charactersIgnoringModifiers(), even though the synthetic helper already sends virtual key code 40.

Implementation

  • remove isKeyWindow() as a prerequisite for app-local key bridging;
  • keep only the existence of the main ClosedRoom window as the bounded owner check;
  • recognize Cmd-K through command modifier + (keyCode == 40 or semantic character k), preserving keyboard-layout semantics while giving synthetic delivery a deterministic key-code path;
  • keep Escape on key code 53;
  • preserve the original AppKit event (return event) so real keyboard/WebKit delivery is not suppressed;
  • keep frontend Search/Dialog ownership and the canonical REAL_ENVIRONMENT assertions unchanged.

Product / privacy

  • PRODUCT_LOCAL: stabilizes an already-settled keyboard shortcut behavior;
  • no meeting/transcript content crosses this boundary;
  • no cloud processing, remote fallback or external transfer;
  • no capture, persistence, transcription, inference or storage behavior changes.

Four axes

  • PRODUCT: PRODUCT_LOCAL
  • DELIVERY: INTEGRATION
  • VALIDATION: repository selector authoritative; exact packaged behavior still requires fresh REAL_ENVIRONMENT after integration
  • EXECUTION: REMOTE_AUTOMATED + REAL_ENVIRONMENT for the native keyboard path

Release PR #49 remains blocked; if this integrates, dev moves again and exact-candidate release evidence must be regenerated.

@daniele21
daniele21 merged commit 06bfefe into dev Sep 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant