authorgravatar for lucenz@proton.meSimone <lucenz@proton.me> 2026-09-12 22:45:55+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-12 17:45:55-03:00
logcfeaca41ae27bdf2c203158d378c87c7308fea2a
tree69fd214706f03f2ea6dcd4240830118d060c197c
parent3486451525ecaf3a8379aa6d08c885c7cc5335e3
signature Signed by PGP key B5690EEEBB952194

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

Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com>

2 files changed, 6 insertions(+), 0 deletions(-)

apps/web/src/components/ChatView.logic.test.ts+4
...@@ -2180,6 +2180,10 @@ describe("shouldRefocusComposerOnWindowFocus", () => {...@@ -2180,6 +2180,10 @@ describe("shouldRefocusComposerOnWindowFocus", () => {
2180 expect(shouldRefocusComposerOnWindowFocus(element("DIV", { role: "textbox" }))).toBe(false);2180 expect(shouldRefocusComposerOnWindowFocus(element("DIV", { role: "textbox" }))).toBe(false);
2181 });2181 });
21822182
2183 it.each(["IFRAME", "WEBVIEW"])("leaves a focused %s preview alone", (tagName) => {
2184 expect(shouldRefocusComposerOnWindowFocus(element(tagName))).toBe(false);
2185 });
2186
2183 it("leaves a focused terminal alone in the drawer and the right panel", () => {2187 it("leaves a focused terminal alone in the drawer and the right panel", () => {
2184 expect(2188 expect(
2185 shouldRefocusComposerOnWindowFocus(element("BUTTON", { within: "data-terminal-owner" })),2189 shouldRefocusComposerOnWindowFocus(element("BUTTON", { within: "data-terminal-owner" })),
apps/web/src/components/ChatView.logic.ts+2
...@@ -1350,6 +1350,8 @@ export function shouldRefocusComposerOnWindowFocus(...@@ -1350,6 +1350,8 @@ export function shouldRefocusComposerOnWindowFocus(
1350 activeElement.tagName === "INPUT" ||1350 activeElement.tagName === "INPUT" ||
1351 activeElement.tagName === "TEXTAREA" ||1351 activeElement.tagName === "TEXTAREA" ||
1352 activeElement.tagName === "SELECT" ||1352 activeElement.tagName === "SELECT" ||
1353 activeElement.tagName === "IFRAME" ||
1354 activeElement.tagName === "WEBVIEW" ||
1353 activeElement.isContentEditable === true ||1355 activeElement.isContentEditable === true ||
1354 activeElement.getAttribute("role") === "textbox"1356 activeElement.getAttribute("role") === "textbox"
1355 ) {1357 ) {