commit bdb56dc2ef16b0cab3c332134541c03bf64c05e3
parent 9b36cfda56c99cbd06735e4fa9277c8604a20706
Author: Nikki Sharpley <nsharpley@mozilla.com>
Date: Wed, 3 Dec 2025 16:24:33 +0000
Bug 1997875 - Select unselected split view panel if clicking dialog within panel. r=sclements
This was primarily to fix selected a print preview but should work for any dialog bugs.
Differential Revision: https://phabricator.services.mozilla.com/D274436
Diffstat:
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/toolkit/modules/SubDialog.sys.mjs b/toolkit/modules/SubDialog.sys.mjs
@@ -1088,7 +1088,7 @@ export class SubDialogManager {
/**
* Abort open dialogs.
*
- * @param {function} [filterFn] - Function which should return true for
+ * @param {Function} [filterFn] - Function which should return true for
* dialogs that should be aborted and false for dialogs that should remain
* open. Defaults to aborting all dialogs.
*/
@@ -1121,6 +1121,25 @@ export class SubDialogManager {
this._onDialogClose(aEvent.detail.dialog);
break;
}
+ case "click": {
+ this._onClickSplitViewPanel(aEvent);
+ break;
+ }
+ }
+ }
+
+ _onClickSplitViewPanel(aEvent) {
+ const splitViewPanel =
+ aEvent.currentTarget.offsetParent.closest(".split-view-panel");
+ // If the dialog is within a split view panel and the panel is currently not
+ // selected, select corresponding tab.
+ if (splitViewPanel) {
+ const browser = splitViewPanel.querySelector("browser");
+ const tabbrowser = browser.getTabBrowser();
+ const tabbox = aEvent.currentTarget.offsetParent.closest("tabbox");
+ const tab = tabbrowser.getTabForBrowser(browser);
+ const tabstrip = tabbox.tabs;
+ tabstrip.selectedItem = tab;
}
}
@@ -1177,11 +1196,13 @@ export class SubDialogManager {
_ensureStackEventListeners() {
this._dialogStack.addEventListener("dialogopen", this);
this._dialogStack.addEventListener("dialogclose", this);
+ this._dialogStack.addEventListener("click", this);
}
_removeStackEventListeners() {
this._dialogStack.removeEventListener("dialogopen", this);
this._dialogStack.removeEventListener("dialogclose", this);
+ this._dialogStack.removeEventListener("click", this);
}
}