From 4895d755357cf5ca5983bea32c968d16f41c0d6d Mon Sep 17 00:00:00 2001 From: Evie Gauthier Date: Mon, 9 Mar 2026 17:30:29 -0400 Subject: [PATCH] fix(notifications): always fire OS notification on desktop (Discord-style) --- src/app/pages/client/ClientNonUIFeatures.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/app/pages/client/ClientNonUIFeatures.tsx b/src/app/pages/client/ClientNonUIFeatures.tsx index b4ba4025..c7b740e9 100644 --- a/src/app/pages/client/ClientNonUIFeatures.tsx +++ b/src/app/pages/client/ClientNonUIFeatures.tsx @@ -321,17 +321,16 @@ function MessageNotifications() { if (first) notifiedEventsRef.current.delete(first); } - // On desktop: fire an OS notification when the window is not focused so - // the user is alerted while the browser is minimised or the tab is in the - // background. When the window IS focused the in-app banner (below) is the - // appropriate alert — we skip the OS notification to avoid a duplicate. + // On desktop: fire an OS notification whenever system notifications are + // enabled and permission is granted — regardless of whether the window is + // focused. When the window is also visible the in-app banner fires too, + // mirroring the behaviour of apps like Discord. // The whole block is wrapped in try/catch: window.Notification() can throw // in sandboxed environments, browsers with DnD active, or Electron — and // an uncaught exception here would abort the handler before setInAppBanner // is reached, causing in-app notifications to silently vanish too. if ( !mobileOrTablet() && - !document.hasFocus() && showSystemNotifications && notificationPermission('granted') ) {