The best way to control Claude Code, Codex and more from any computer or phone
fix(web): preserve preview focus on window return (#11444)
Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com>
Simone committed
Sep 12, 2026 at 22:45 UTC
cfeaca41ae27bdf2c203158d378c87c7308fea2a
2 files changed
+6
apps/web/src/components/ChatView.logic.test.ts
+4
@@ -2180,6 +2180,10 @@ describe("shouldRefocusComposerOnWindowFocus", () => {
2180
expect(shouldRefocusComposerOnWindowFocus(element("DIV", { role: "textbox" }))).toBe(false);
2181
});
2182
2183
+ it.each(["IFRAME", "WEBVIEW"])("leaves a focused %s preview alone", (tagName) => {
2184
+ expect(shouldRefocusComposerOnWindowFocus(element(tagName))).toBe(false);
2185
+ });
2186
+
2187
it("leaves a focused terminal alone in the drawer and the right panel", () => {
2188
expect(
2189
shouldRefocusComposerOnWindowFocus(element("BUTTON", { within: "data-terminal-owner" })),
apps/web/src/components/ChatView.logic.ts
+2
@@ -1350,6 +1350,8 @@ export function shouldRefocusComposerOnWindowFocus(
1350
activeElement.tagName === "INPUT" ||
1351
activeElement.tagName === "TEXTAREA" ||
1352
activeElement.tagName === "SELECT" ||
1353
+ activeElement.tagName === "IFRAME" ||
1354
+ activeElement.tagName === "WEBVIEW" ||
1355
activeElement.isContentEditable === true ||
1356
activeElement.getAttribute("role") === "textbox"
1357
) {