Bug 1696260 - Keep app menu button badges showing while the menu is open. r=mconley
authorMolly Howell <mhowell@mozilla.com>
Mon, 15 Mar 2021 15:51:19 +0000
changeset 571279 de824d678e9dfc887618fa9f2d1736208c3dcc08
parent 571278 049ce457ce72eaf66cc2c322ae50f06dbf88a139
child 571280 dfda1b86208afe71acf1b02af2ab7b4629ad6714
push id38287
push userdluca@mozilla.com
push dateMon, 15 Mar 2021 21:48:53 +0000
treeherdermozilla-central@e8346137ae4e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1696260
milestone88.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1696260 - Keep app menu button badges showing while the menu is open. r=mconley Differential Revision: https://phabricator.services.mozilla.com/D107950
browser/components/customizableui/content/panelUI.js
browser/components/customizableui/test/browser_panelUINotifications.js
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -763,26 +763,27 @@ const PanelUI = {
       return;
     }
 
     let doorhangers = notifications.filter(
       n => !n.dismissed && !n.options.badgeOnly
     );
 
     if (this.panel.state == "showing" || this.panel.state == "open") {
-      // If the menu is already showing, then we need to dismiss all notifications
-      // since we don't want their doorhangers competing for attention
+      // If the menu is already showing, then we need to dismiss all
+      // notifications since we don't want their doorhangers competing for
+      // attention. Don't hide the badge though; it isn't really in competition
+      // with anything.
       doorhangers.forEach(n => {
         n.dismissed = true;
         if (n.options.onDismissed) {
           n.options.onDismissed(window);
         }
       });
       this._hidePopup();
-      this._clearBadge();
       if (!notifications[0].options.badgeOnly) {
         this._showBannerItem(notifications[0]);
       }
     } else if (doorhangers.length) {
       // Only show the doorhanger if the window is focused and not fullscreen
       if (
         (window.fullScreen && this.autoHideToolbarInFullScreen) ||
         Services.focus.activeWindow !== window
--- a/browser/components/customizableui/test/browser_panelUINotifications.js
+++ b/browser/components/customizableui/test/browser_panelUINotifications.js
@@ -123,20 +123,20 @@ add_task(async function testSecondaryAct
 
     is(
       PanelUI.menuButton.getAttribute("badge-status"),
       "update-manual",
       "Badge is displaying on PanelUI button."
     );
 
     await gCUITestUtils.openMainMenu();
-    isnot(
+    is(
       PanelUI.menuButton.getAttribute("badge-status"),
       "update-manual",
-      "Badge is hidden on PanelUI button."
+      "Badge is displaying on PanelUI button."
     );
     let menuItem = PanelUI.mainView.querySelector(".panel-banner-item");
     is(
       menuItem.label,
       menuItem.getAttribute("label-update-manual"),
       "Showing correct label"
     );
     is(menuItem.hidden, false, "update-manual menu item is showing.");
@@ -185,20 +185,20 @@ add_task(async function testDownloadingB
 
     is(
       PanelUI.menuButton.getAttribute("badge-status"),
       "update-downloading",
       "Downloading badge is displaying on PanelUI button."
     );
 
     await gCUITestUtils.openMainMenu();
-    isnot(
+    is(
       PanelUI.menuButton.getAttribute("badge-status"),
       "update-downloading",
-      "Downloading badge is hidden on PanelUI button."
+      "Downloading badge is displaying on PanelUI button."
     );
     let menuItem = PanelUI.mainView.querySelector(".panel-banner-item");
     is(
       menuItem.label,
       menuItem.getAttribute("label-update-downloading"),
       "Showing correct label (downloading)"
     );
     is(menuItem.hidden, false, "update-downloading menu item is showing.");
@@ -282,20 +282,20 @@ add_task(async function testInteractionW
 
     is(
       PanelUI.menuButton.getAttribute("badge-status"),
       "update-manual",
       "Badge is displaying on PanelUI button."
     );
 
     await gCUITestUtils.openMainMenu();
-    isnot(
+    is(
       PanelUI.menuButton.getAttribute("badge-status"),
       "update-manual",
-      "Badge is hidden on PanelUI button."
+      "Badge is displaying on PanelUI button."
     );
     let menuItem = PanelUI.mainView.querySelector(".panel-banner-item");
     is(
       menuItem.label,
       menuItem.getAttribute("label-update-manual"),
       "Showing correct label"
     );
     is(menuItem.hidden, false, "update-manual menu item is showing.");
@@ -533,20 +533,20 @@ add_task(async function testMultipleNonB
     );
     is(
       PanelUI.menuButton.getAttribute("badge-status"),
       "update-restart",
       "update-restart badge is displaying on PanelUI button."
     );
 
     await gCUITestUtils.openMainMenu();
-    isnot(
+    is(
       PanelUI.menuButton.getAttribute("badge-status"),
       "update-restart",
-      "update-restart badge is hidden on PanelUI button."
+      "update-restart badge is displaying on PanelUI button."
     );
     let menuItem = PanelUI.mainView.querySelector(".panel-banner-item");
     is(
       menuItem.label,
       menuItem.getAttribute("label-update-restart"),
       "Showing correct label"
     );
     is(menuItem.hidden, false, "update-restart menu item is showing.");
@@ -564,20 +564,20 @@ add_task(async function testMultipleNonB
     );
     is(
       PanelUI.menuButton.getAttribute("badge-status"),
       "update-manual",
       "update-manual badge is displaying on PanelUI button."
     );
 
     await gCUITestUtils.openMainMenu();
-    isnot(
+    is(
       PanelUI.menuButton.getAttribute("badge-status"),
       "update-manual",
-      "update-manual badge is hidden on PanelUI button."
+      "update-manual badge is displaying on PanelUI button."
     );
     is(
       menuItem.label,
       menuItem.getAttribute("label-update-manual"),
       "Showing correct label"
     );
     is(menuItem.hidden, false, "update-manual menu item is showing.");