Skip to content

Commit 2831d5f

Browse files
jnunemakerclaude
andcommitted
fix(web): mod+L focuses the browser address bar from a focused page
A focused browser page runs in its own process, so the app never saw mod+L and the default preview.focusUrl binding only worked from the browser chrome. Forward it like the layout toggles and handle the menu action in the visible browser. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 67c0fc0 commit 2831d5f

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

‎apps/web/src/components/ReopenClosedViewShortcut.browser.test.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,12 @@ describe("root reopen shortcut", () => {
323323
expect(forwardedCommands()).not.toContain("view.reopenClosed");
324324
});
325325

326-
it("always forwards the layout toggles out of a focused desktop browser", async () => {
326+
it("always forwards the layout toggles and address bar out of a focused desktop browser", async () => {
327327
await render();
328328
expect(state.setShortcuts).toHaveBeenLastCalledWith([
329329
expect.objectContaining({ command: "sidebar.toggle" }),
330330
expect.objectContaining({ command: "rightPanel.toggle" }),
331+
expect.objectContaining({ command: "preview.focusUrl" }),
331332
]);
332333
});
333334
});

‎apps/web/src/components/ReopenClosedViewShortcut.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ import {
4343
} from "../threadRoutes";
4444
import { toastManager } from "./ui/toast";
4545

46-
const PREVIEW_FORWARDED_LAYOUT_COMMANDS = [
46+
const PREVIEW_FORWARDED_COMMANDS = [
4747
"sidebar.toggle",
4848
"rightPanel.toggle",
4949
"rightPanel.toggleMaximized",
50+
"preview.focusUrl",
5051
] as const;
5152

5253
const isGlobalPullRequests = (ref: ScopedThreadRef) =>
@@ -198,7 +199,7 @@ export function ReopenClosedViewShortcut() {
198199
// sends each command back as a menu action.
199200
const commands = [
200201
...(hasHistory ? (["view.reopenClosed"] as const) : []),
201-
...PREVIEW_FORWARDED_LAYOUT_COMMANDS,
202+
...PREVIEW_FORWARDED_COMMANDS,
202203
];
203204
void preview
204205
.setForwardedShortcuts(

‎apps/web/src/components/preview/PreviewView.tsx‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,15 @@ export function PreviewView({
906906
);
907907
useEffect(() => {
908908
if (!visible) return;
909-
return subscribePreviewAction((action) => onPreviewAction(action));
909+
const unsubscribeAction = subscribePreviewAction((action) => onPreviewAction(action));
910+
// A focused page is a separate process, so the desktop forwards its address-bar chord back.
911+
const unsubscribeMenu = window.desktopBridge?.onMenuAction((action) => {
912+
if (action === "preview.focusUrl") onPreviewAction("focus-url");
913+
});
914+
return () => {
915+
unsubscribeAction();
916+
unsubscribeMenu?.();
917+
};
910918
}, [visible]);
911919

912920
return (

0 commit comments

Comments
 (0)