fix(web): preserve preview focus on window return (#11444)

Co-authored-by: Simone <[email protected]>
This commit is contained in:
SimoneandSimone authored and GitHub committed 2026-09-12 17:45:55 -03:00
1 parent 3486451525
commit cfeaca41ae
2 files changed
+6

No files matched your search

@@ -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" })),
@@ -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"
) {