Skip to content

Commit cfeaca4

Browse files
authored
fix(web): preserve preview focus on window return (#11444)
Co-authored-by: Simone <[email protected]>
1 parent 3486451 commit cfeaca4

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎apps/web/src/components/ChatView.logic.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,6 +2180,10 @@ describe("shouldRefocusComposerOnWindowFocus", () => {
21802180
expect(shouldRefocusComposerOnWindowFocus(element("DIV", { role: "textbox" }))).toBe(false);
21812181
});
21822182

2183+
it.each(["IFRAME", "WEBVIEW"])("leaves a focused %s preview alone", (tagName) => {
2184+
expect(shouldRefocusComposerOnWindowFocus(element(tagName))).toBe(false);
2185+
});
2186+
21832187
it("leaves a focused terminal alone in the drawer and the right panel", () => {
21842188
expect(
21852189
shouldRefocusComposerOnWindowFocus(element("BUTTON", { within: "data-terminal-owner" })),

‎apps/web/src/components/ChatView.logic.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,8 @@ export function shouldRefocusComposerOnWindowFocus(
13501350
activeElement.tagName === "INPUT" ||
13511351
activeElement.tagName === "TEXTAREA" ||
13521352
activeElement.tagName === "SELECT" ||
1353+
activeElement.tagName === "IFRAME" ||
1354+
activeElement.tagName === "WEBVIEW" ||
13531355
activeElement.isContentEditable === true ||
13541356
activeElement.getAttribute("role") === "textbox"
13551357
) {

0 commit comments

Comments
 (0)