Skip to content

Commit 942aeb0

Browse files
fix(desktop): AltGr symbols no longer open browser find from the page
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent e3d0a1b commit 942aeb0

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

‎apps/desktop/src/preview/Manager.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,23 @@ describe("PreviewManager", () => {
713713
);
714714
expect(preventDefault).toHaveBeenCalledOnce();
715715
expect(send).toHaveBeenCalledTimes(2);
716+
717+
Object.assign(preview.webContents, { focusedFrame: mainFrame });
718+
yield* manager.setForwardedShortcuts([
719+
{ command: "preview.find", shortcut: parseKeybindingShortcut("ctrl+alt+8")! },
720+
]);
721+
pageUnhandledShortcut(
722+
{},
723+
{
724+
key: "[",
725+
code: "Digit8",
726+
metaKey: false,
727+
ctrlKey: true,
728+
shiftKey: false,
729+
altKey: true,
730+
},
731+
);
732+
expect(send).toHaveBeenCalledTimes(usesMeta ? 3 : 2);
716733
}),
717734
platform,
718735
),

‎apps/desktop/src/preview/Manager.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,12 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
14681468
});
14691469
};
14701470
const findForwardedShortcut = (keys: Parameters<typeof matchesKeybindingShortcut>[0]) =>
1471+
!(
1472+
hostPlatform !== "darwin" &&
1473+
keys.ctrlKey &&
1474+
keys.altKey &&
1475+
/^(?:[^a-zA-Z0-9]|Dead)$/u.test(keys.key)
1476+
) &&
14711477
forwardedShortcuts.find(({ shortcut }) =>
14721478
matchesKeybindingShortcut(
14731479
keys,
@@ -1494,12 +1500,6 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
14941500
host &&
14951501
!host.isDestroyed() &&
14961502
holdsKeyboardFocus(wc) &&
1497-
!(
1498-
hostPlatform !== "darwin" &&
1499-
input.control &&
1500-
input.alt &&
1501-
/^(?:[^a-zA-Z0-9]|Dead)$/u.test(input.key)
1502-
) &&
15031503
findForwardedShortcut({
15041504
key: input.key,
15051505
code: input.code,

0 commit comments

Comments
 (0)