fix(desktop): isolate preview shortcuts from the host - #232
Open
leoisadev1 wants to merge 1 commit into
Open
Conversation
Stop forwarding preview chords into the main window, ignore host menu accelerators, and re-enable native editing shortcuts only while the preview guest is focused.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Greptile SummaryThis PR isolates keyboard input in desktop preview guests from host application accelerators while selectively enabling native editing roles for the focused guest.
Confidence Score: 5/5The PR appears safe to merge; no concrete correctness, security, or repository-rule violations were identified. Shortcut classification matches the native edit-menu roles, non-editing chords remain isolated from the host, refresh is handled explicitly, and popup behavior follows the same focus-aware policy. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Preview keyDown] --> B{Focused preview editing chord?}
B -->|Yes| C[Enable native menu shortcuts]
B -->|No| D[Ignore host menu shortcuts]
C --> E[Native edit role handles chord]
D --> F{Cmd/Ctrl+R?}
F -->|Yes| G[Prevent default and reload preview]
F -->|No| H[Guest page handles input]
Reviews (1): Last reviewed commit: "fix(desktop): isolate preview shortcuts ..." | Re-trigger Greptile |
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.
Problem
Keys typed in the in-app browser were forwarded into the host window. Cmd/Ctrl+K, comma, W, and Shift+J ran Akeru actions instead of staying in the page. Isolating those chords with
setIgnoreMenuShortcutsthen blocked native Cut/Copy/Paste/Undo in the guest.Changes
Ignore host menu accelerators for preview guests. Stop synthesizing host key events. Re-enable native editing shortcuts only while that guest is focused, including macOS Paste and Match Style. Cmd/Ctrl+R still reloads the preview.
If a popup is created anyway, apply the same isolation. Akeru still denies
window.openand loads the URL in the same guest.Adapted from pingdotgg#9840 and pingdotgg#10621.
Scope
This PR is preview keyboard isolation only.
Covered here:
Still assigned to this handoff, in later PRs:
Verification
vp test run apps/desktop/src/preview/Manager.test.ts: 78 passed, including host-shortcut isolation and focused editing in tabs plus popups.vp linton the two files: no new errors. Pre-existing unusedNativeImageimport warning remains.Native Cmd/Ctrl editing in a real Electron preview was not run on this Linux host.
Implemented and verified by Grok 4.6 High in Grok Build via Orca.