From 4712b70f959310708c76cf2f68d88920222fa64d Mon Sep 17 00:00:00 2001
From: Paul Zuehlcke <pbz@mozilla.com>
Date: Wed, 24 Apr 2024 13:24:23 +0000
Subject: [PATCH] Bug 1886082, r=Gijs,emilio, a=dmeehan

Differential Revision: https://phabricator.services.mozilla.com/D207253
---
 toolkit/modules/PopupNotifications.sys.mjs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/toolkit/modules/PopupNotifications.sys.mjs b/toolkit/modules/PopupNotifications.sys.mjs
index 0c3322017409b..370953a2714e1 100644
--- a/toolkit/modules/PopupNotifications.sys.mjs
+++ b/toolkit/modules/PopupNotifications.sys.mjs
@@ -1939,10 +1939,14 @@ PopupNotifications.prototype = {
     }
 
     if (type == "buttoncommand" || type == "secondarybuttoncommand") {
-      if (Services.focus.activeWindow != this.window) {
+      // TODO: Bug 1892756.
+      if (
+        Services.focus.activeWindow != this.window ||
+        notificationEl.matches(":-moz-window-inactive")
+      ) {
         Services.console.logStringMessage(
           "PopupNotifications._onButtonEvent: " +
-            "Button click happened before the window was focused"
+            "Button click happened before the window was focused / active"
         );
         this.window.focus();
         return;
-- 
GitLab