diff --git a/toolkit/content/widgets/panel.js b/toolkit/content/widgets/panel.js
index dc3e34847f1b6dfd58f5e036fd7d714ef51c1380..8d8e370ca8549d8208669d4fb344fc8abb54fadd 100644
--- a/toolkit/content/widgets/panel.js
+++ b/toolkit/content/widgets/panel.js
@@ -137,6 +137,9 @@
             this.anchorNode.closest("toolbarbutton, .anchor-root") ||
             this.anchorNode;
           anchorRoot.setAttribute("open", "true");
+          if (anchorRoot.closest("#urlbar") && window.gURLBar) {
+            gURLBar.setAttribute("has-popup-open", "true");
+          }
         }
 
         if (this.getAttribute("animate") != "false") {
@@ -183,6 +186,9 @@
             this.anchorNode.closest("toolbarbutton, .anchor-root") ||
             this.anchorNode;
           anchorRoot.removeAttribute("open");
+          if (anchorRoot.closest("#urlbar") && window.gURLBar) {
+            gURLBar.removeAttribute("has-popup-open");
+          }
         }
       }
 
