From a84bd5b0ce2eb3e894f113d0a470955e8573af33 Mon Sep 17 00:00:00 2001 From: "Mr. M" Date: Tue, 2 Dec 2025 14:32:16 +0100 Subject: [PATCH] fix: Fixed going back to a different window not allowing to type on inputs, b=no-bug, c=no-component --- src/zen/sessionstore/ZenWindowSync.sys.mjs | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/zen/sessionstore/ZenWindowSync.sys.mjs b/src/zen/sessionstore/ZenWindowSync.sys.mjs index cfa4ddb52..dc195c2ea 100644 --- a/src/zen/sessionstore/ZenWindowSync.sys.mjs +++ b/src/zen/sessionstore/ZenWindowSync.sys.mjs @@ -346,19 +346,19 @@ class nsZenWindowSync { * @param {Object} aOtherTab - The tab in the other window. */ async #swapBrowserDocShells(aOurTab, aOtherTab) { - try { - await this.#styleSwapedBrowsers(aOurTab, aOtherTab); - aOurTab.ownerGlobal.gBrowser.swapBrowsersAndCloseOther(aOurTab, aOtherTab, false); - const kAttributesToRemove = ['muted', 'soundplaying', 'sharing', 'pictureinpicture']; - // swapBrowsersAndCloseOther already takes care of transferring attributes like 'muted', - // but we need to manually remove some attributes from the other tab. - for (let attr of kAttributesToRemove) { - aOtherTab.removeAttribute(attr); - } - } catch (e) { - // Handle any errors that may occur during the swapBrowsers operation. - console.error('Error swapping browsers:', e); + await this.#styleSwapedBrowsers(aOurTab, aOtherTab); + aOurTab.ownerGlobal.gBrowser.swapBrowsersAndCloseOther(aOurTab, aOtherTab, false); + const kAttributesToRemove = ['muted', 'soundplaying', 'sharing', 'pictureinpicture']; + // swapBrowsersAndCloseOther already takes care of transferring attributes like 'muted', + // but we need to manually remove some attributes from the other tab. + for (let attr of kAttributesToRemove) { + aOtherTab.removeAttribute(attr); } + + // Recalculate the focus in order to allow the user to continue typing + // inside the web contentx area without having to click outside and back in. + aOurTab.linkedBrowser.blur(); + aOurTab.ownerGlobal.gBrowser._adjustFocusAfterTabSwitch(aOurTab); } /**