From 7fb38dfb81e3b738df70b5dd13f6325e053ee12a Mon Sep 17 00:00:00 2001
From: Gijs Kruitbosch <gijskruitbosch@gmail.com>
Date: Thu, 22 Aug 2024 23:13:19 +0000
Subject: [PATCH] Bug 1909163 - mark select dropdown as tabspecific,  a=RyanVM

Original Revision: https://phabricator.services.mozilla.com/D217232

Differential Revision: https://phabricator.services.mozilla.com/D219917
---
 browser/base/content/browser.js     | 4 ++--
 toolkit/actors/SelectParent.sys.mjs | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index b18f371a47fec..c4d97d1110e5e 100644
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -3604,9 +3604,9 @@ var XULBrowserWindow = {
     };
 
     // If the location is changed due to switching tabs,
-    // ensure we close any open tabspecific panels.
+    // ensure we close any open tabspecific popups.
     if (aIsSimulated) {
-      closeOpenPanels("panel[tabspecific='true']");
+      closeOpenPanels(":is(panel, menupopup)[tabspecific='true']");
     }
 
     // Ensure we close any remaining open locationspecific panels
diff --git a/toolkit/actors/SelectParent.sys.mjs b/toolkit/actors/SelectParent.sys.mjs
index fa8ce002f0cd6..f92c6e8135319 100644
--- a/toolkit/actors/SelectParent.sys.mjs
+++ b/toolkit/actors/SelectParent.sys.mjs
@@ -750,6 +750,7 @@ export class SelectParent extends JSWindowActorParent {
     popup.setAttribute("id", "ContentSelectDropdownPopup");
     popup.setAttribute("activateontab", "true");
     popup.setAttribute("position", "after_start");
+    popup.setAttribute("tabspecific", "true");
     popup.setAttribute("level", "parent");
     if (AppConstants.platform == "win") {
       popup.setAttribute("consumeoutsideclicks", "false");
-- 
GitLab