Skip to content

fix(desktop): isolate preview shortcuts from the host - #232

Open
leoisadev1 wants to merge 1 commit into
mainfrom
fix/desktop-preview-shortcut-isolation
Open

fix(desktop): isolate preview shortcuts from the host#232
leoisadev1 wants to merge 1 commit into
mainfrom
fix/desktop-preview-shortcut-isolation

Conversation

@leoisadev1

Copy link
Copy Markdown
Member

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 setIgnoreMenuShortcuts then 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.open and 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 lint on the two files: no new errors. Pre-existing unused NativeImage import 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.

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.
@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
akeru-bot-landing Skipped Skipped Sep 10, 2026 6:03pm UTC

Request Review

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Sep 10, 2026
@greptile-apps

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown

Greptile Summary

This PR isolates keyboard input in desktop preview guests from host application accelerators while selectively enabling native editing roles for the focused guest.

  • Removes synthetic forwarding of preview shortcuts to the host window.
  • Keeps preview refresh handling local to the guest.
  • Enables native Cut, Copy, Paste, Undo, Redo, Select All, and Paste and Match Style chords only for a focused preview.
  • Applies the same shortcut isolation to any popup that is created.
  • Adds focused coverage for platform-specific editing chords, host isolation, focus checks, and popup behavior.

Confidence Score: 5/5

The 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

Filename Overview
apps/desktop/src/preview/Manager.ts Replaces host shortcut forwarding with focus-aware menu isolation and native editing-shortcut handling for preview guests and popups.
apps/desktop/src/preview/Manager.test.ts Adds comprehensive unit coverage for platform-specific editing shortcuts, host isolation, focus gating, refresh behavior, and popup handling.

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]
Loading

Reviews (1): Last reviewed commit: "fix(desktop): isolate preview shortcuts ..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant