TypeScript
fix(web): preserve preview focus on window return (#11444)
Simonecfeaca41ae27
diff --git a/apps/web/src/components/ChatView.logic.test.ts b/apps/web/src/components/ChatView.logic.test.tsindex 2b9a18cb90f..be279f220e7 100644--- a/apps/web/src/components/ChatView.logic.test.ts+++ b/apps/web/src/components/ChatView.logic.test.ts@@ -2180,6 +2180,10 @@ describe("shouldRefocusComposerOnWindowFocus", () => {expect(shouldRefocusComposerOnWindowFocus(element("DIV", { role: "textbox" }))).toBe(false);});+ it.each(["IFRAME", "WEBVIEW"])("leaves a focused %s preview alone", (tagName) => {+ expect(shouldRefocusComposerOnWindowFocus(element(tagName))).toBe(false);+ });+it("leaves a focused terminal alone in the drawer and the right panel", () => {expect(shouldRefocusComposerOnWindowFocus(element("BUTTON", { within: "data-terminal-owner" })),diff --git a/apps/web/src/components/ChatView.logic.ts b/apps/web/src/components/ChatView.logic.tsindex 2707050070e..ed1422a7110 100644--- a/apps/web/src/components/ChatView.logic.ts+++ b/apps/web/src/components/ChatView.logic.ts@@ -1350,6 +1350,8 @@ export function shouldRefocusComposerOnWindowFocus(activeElement.tagName === "INPUT" ||activeElement.tagName === "TEXTAREA" ||activeElement.tagName === "SELECT" ||+ activeElement.tagName === "IFRAME" ||+ activeElement.tagName === "WEBVIEW" ||activeElement.isContentEditable === true ||activeElement.getAttribute("role") === "textbox") {