Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(notifications): keep the browser notifications prompt off open drawers on phones (#8641)
gbirman7ee84c5580c1
diff --git a/.agents/rules/web/mobile.md b/.agents/rules/web/mobile.mdindex dcff62c2cb..886c21f7e3 100644--- a/.agents/rules/web/mobile.md+++ b/.agents/rules/web/mobile.md@@ -53,6 +53,9 @@ read their code, and follow that pattern rather than inventing a new one.place with a back row.- Overlays are Kobalte or corvu layers or handle Escape: Android Back sendsEscape to the top layer. Own back stacks use `useAndroidBackNavigation`.+- Persistent prompts (`toast.custom` with `persistent`) go to the prompt+ region (`useKeyedPersistentToasts` does it), which hides while a modal layer+ is open; a prompt in the transient region would cover a sheet's controls.## Keyboard and focusdiff --git a/apps/web/src/features/notifications/components/BrowserNotificationModal.test.tsx b/apps/web/src/features/notifications/components/BrowserNotificationModal.test.tsxnew file mode 100644index 0000000000..53d5428811--- /dev/null+++ b/apps/web/src/features/notifications/components/BrowserNotificationModal.test.tsx@@ -0,0 +1,59 @@+/**+ * @vitest-environment jsdom+ */++import { cleanup, render } from '@solidjs/testing-library';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { BrowserNotificationModal } from './BrowserNotificationModal';++const mocks = vi.hoisted(() => ({+ custom: vi.fn(() => 1),+ mobile: false,+}));++vi.mock('@core/component/Toast/Toast', () => ({+ toast: { custom: mocks.custom, dismiss: vi.fn() },+}));+vi.mock('@core/mobile/isMobile', () => ({ isMobile: () => mocks.mobile }));+vi.mock('@core/util/platform', () => ({ isPlatform: () => false }));+vi.mock('@core/context/user', () => ({+ useTutorialCompleted: () => () => true,+}));+vi.mock('@queries/auth', () => ({ useIsAuthenticated: () => () => true }));+vi.mock('../notification-settings', () => ({+ useNotificationSettings: () => ({+ isSupported: true,+ shouldPrompt: () => true,+ dismissPrompt: vi.fn(),+ toggle: vi.fn(),+ }),+}));++beforeEach(() => vi.stubEnv('DEV', false));+afterEach(() => {+ cleanup();+ vi.clearAllMocks();+ vi.unstubAllEnvs();+});++describe('browser notification prompt', () => {+ it('waits in the phone prompt region, which steps aside for open sheets', () => {+ mocks.mobile = true;+ render(() => <BrowserNotificationModal />);++ expect(mocks.custom).toHaveBeenCalledWith(+ expect.objectContaining({ title: 'Enable Browser Notifications' }),+ { persistent: true, region: 'mobile-prompt-region' }+ );+ });++ it('joins the other prompts on desktop', () => {+ mocks.mobile = false;+ render(() => <BrowserNotificationModal />);++ expect(mocks.custom).toHaveBeenCalledWith(expect.anything(), {+ persistent: true,+ region: 'prompt-region',+ });+ });+});diff --git a/apps/web/src/features/notifications/components/BrowserNotificationModal.tsx b/apps/web/src/features/notifications/components/BrowserNotificationModal.tsxindex 3a5adbbe20..dc20b611d2 100644--- a/apps/web/src/features/notifications/components/BrowserNotificationModal.tsx+++ b/apps/web/src/features/notifications/components/BrowserNotificationModal.tsx@@ -1,5 +1,6 @@import { toast } from '@core/component/Toast/Toast';import { useTutorialCompleted } from '@core/context/user';+import { isMobile } from '@core/mobile/isMobile';import { isPlatform } from '@core/util/platform';import Bell from '@phosphor/bell.svg';import { useIsAuthenticated } from '@queries/auth';@@ -69,7 +70,10 @@ function NotificationToastTrigger(props: {},],},- { persistent: true }+ {+ persistent: true,+ region: isMobile() ? 'mobile-prompt-region' : 'prompt-region',+ });});diff --git a/apps/web/src/lib/core/component/Toast/ToastRegion.tsx b/apps/web/src/lib/core/component/Toast/ToastRegion.tsxindex 96c0563d1e..a5fc190933 100644--- a/apps/web/src/lib/core/component/Toast/ToastRegion.tsx+++ b/apps/web/src/lib/core/component/Toast/ToastRegion.tsx@@ -48,7 +48,8 @@ export function ToastRegion() {transient toast is visible — Toast.tsx dismisses the previous one assoon as a new one is shown. Persistent prompts live in their ownregion above that slot, capped at one visible card with the rest- queued until it is answered.+ queued until it is answered. Prompts step aside while a drawer, sheet,+ or dialog is open, so they never cover its controls.*/}<divclass="fixed left-1/2 -translate-x-1/2 w-full max-w-[420px] px-(--mobile-chrome-gutter) pointer-events-none z-toast-region flex flex-col gap-2"@@ -71,6 +72,7 @@ export function ToastRegion() {limit={1}pauseOnInteraction={false}swipeDirection="left"+ class="in-[body:has([aria-modal=true])]:hidden"><Toast.List class="flex flex-col gap-2" /></Toast.Region>diff --git a/docs/agent-guide/settings.md b/docs/agent-guide/settings.mdindex 543d2b8809..b1ed8b8699 100644--- a/docs/agent-guide/settings.md+++ b/docs/agent-guide/settings.md@@ -82,7 +82,9 @@ After onboarding, an eligible desktop app user sees **Enable DesktopNotifications**. Select **Enable** to request permission through the nativenotification provider; macOS uses its system permission dialog. The web promptcontinues to say **Enable Browser Notifications** and uses browser permissions.-Select **Hide** to dismiss the prompt.+Select **Hide** to dismiss the prompt. It waits in the same region as other+prompts, one card at a time, and on a phone it steps aside while a drawer,+sheet, or dialog is open and comes back when it closes.### Notification snoozes