fix: stabilize native Cmd-K and Escape bridge - #61
Merged
Merged
Conversation
This was referenced Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:keyboard_cmd_k_searchfailed;AXTextField, Escape failed;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
isKeyWindow()as a prerequisite for app-local key bridging;keyCode == 40or semantic characterk), preserving keyboard-layout semantics while giving synthetic delivery a deterministic key-code path;return event) so real keyboard/WebKit delivery is not suppressed;Product / privacy
Four axes
Release PR #49 remains blocked; if this integrates,
devmoves again and exact-candidate release evidence must be regenerated.