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(toasts): simplify mobile dismissal and task actions (#9230)
Peter Chinman74bdfa9aa916
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.mdindex 0ad81eaaca..8a864a1409 100644--- a/apps/web/AGENTS.md+++ b/apps/web/AGENTS.md@@ -825,7 +825,7 @@ See the [download walkthrough](../../docs/agent-guide/files.md#downloading-files### Creation choices and notifications- Reuse `CreateMenuItem` for explanatory New menu entries: original icons, a title, and muted wrapping descriptions, preserving the existing `ViewCreateButton` trigger and each action's feature gates.-- Keep transient toasts in their bounded stack and persistent prompts/reminders in separate regions; preserve keyboard dismissal, full mobile descriptions, and remaining-time pause on hover/focus.+- Keep transient toasts in their bounded stack and persistent prompts/reminders in separate regions; preserve keyboard dismissal, full mobile descriptions, and remaining-time pause on hover/focus. Mobile toasts dismiss by swiping left or right and have no corner close button.- Notification sounds are off by default and saved per user per device; map each new notification event in `features/notification-sounds/core/categories.ts` and keep system alerts silent when Macro plays its own sound. See the [notification sounds walkthrough](../../docs/agent-guide/notifications.md#notification-sounds).### Sidebar tag draggingdiff --git a/apps/web/src/components/view-shell/browser-test/creation-and-toasts.browser.e2e.ts b/apps/web/src/components/view-shell/browser-test/creation-and-toasts.browser.e2e.tsindex 00e77a1355..0389c5cea8 100644--- a/apps/web/src/components/view-shell/browser-test/creation-and-toasts.browser.e2e.ts+++ b/apps/web/src/components/view-shell/browser-test/creation-and-toasts.browser.e2e.ts@@ -1,4 +1,4 @@-import { expect, test } from '@playwright/test';+import { expect, type Locator, type Page, test } from '@playwright/test';const fixture ='/src/components/view-shell/browser-test/creation-and-toasts.html';@@ -54,3 +54,71 @@ for (const viewport of [});});}++async function swipe(page: Page, toast: Locator, deltaX: number, deltaY = 0) {+ const bounds = await toast.boundingBox();+ expect(bounds).not.toBeNull();+ const x = bounds!.x + bounds!.width / 2;+ const y = bounds!.y + bounds!.height / 2;+ const session = await page.context().newCDPSession(page);+ await session.send('Input.dispatchTouchEvent', {+ type: 'touchStart',+ touchPoints: [{ x, y }],+ });+ for (let step = 1; step <= 4; step++) {+ await session.send('Input.dispatchTouchEvent', {+ type: 'touchMove',+ touchPoints: [{ x: x + (deltaX * step) / 4, y: y + (deltaY * step) / 4 }],+ });+ }+ await session.send('Input.dispatchTouchEvent', {+ type: 'touchEnd',+ touchPoints: [],+ });+ await session.detach();+}++test.describe('mobile swipe dismissal', () => {+ test.use({+ hasTouch: true,+ viewport: { width: 390, height: 844 },+ contextOptions: { reducedMotion: 'reduce' },+ });++ for (const direction of ['left', 'right'] as const) {+ test(`dismisses notices, prompts, and reminders to the ${direction}`, async ({+ page,+ }) => {+ await page.goto(fixture);+ const deltaX = direction === 'left' ? -120 : 120;+ const toast = page.locator('[data-macro-toast]');++ await page.getByRole('button', { name: 'Show notices' }).click();+ await expect(toast).toHaveCount(1);+ await swipe(page, toast, 0, -70);+ await expect(toast).toHaveCount(1);+ await swipe(page, toast, deltaX / 4);+ await expect(toast).toHaveCount(1);+ await swipe(page, toast, deltaX);+ await expect(toast).toHaveCount(0);++ await page.getByRole('button', { name: 'Show prompt' }).click();+ await toast.getByRole('button', { name: 'Review' }).click();+ await expect(+ page.getByText('Reviewed demo — this preview does not save data.')+ ).toBeVisible();+ await swipe(page, toast, deltaX);+ await expect(toast).toHaveCount(0);+ await expect(+ page.getByText('Dismissals: 1', { exact: true })+ ).toBeVisible();++ await page.getByRole('button', { name: 'Show reminder' }).click();+ await swipe(page, toast, deltaX);+ await expect(toast).toHaveCount(0);+ await expect(+ page.getByText('Dismissals: 2', { exact: true })+ ).toBeVisible();+ });+ }+});diff --git a/apps/web/src/components/view-shell/browser-test/creation-and-toasts.tsx b/apps/web/src/components/view-shell/browser-test/creation-and-toasts.tsxindex 03ef476f81..a9aaf5d982 100644--- a/apps/web/src/components/view-shell/browser-test/creation-and-toasts.tsx+++ b/apps/web/src/components/view-shell/browser-test/creation-and-toasts.tsx@@ -13,6 +13,7 @@ document.documentElement.dataset.touchDevice = String(isTouchDevice());function Fixture() {const [view, setView] = createSignal('messages');const [selected, setSelected] = createSignal('Nothing created');+ const [dismissals, setDismissals] = createSignal(0);return (<main class="min-h-screen bg-page p-8 text-ink"><h1 class="mb-6 text-xl font-semibold">@@ -54,16 +55,34 @@ function Fixture() {{persistent: true,region: isMobile() ? 'mobile-prompt-region' : 'prompt-region',+ onUserDismiss: () => setDismissals((count) => count + 1),})}>Show prompt</Button>+ <Button+ onClick={() =>+ toast.custom(+ { title: 'Reminder preview' },+ {+ persistent: true,+ region: isMobile()+ ? 'mobile-reminder-region'+ : 'reminder-region',+ onUserDismiss: () => setDismissals((count) => count + 1),+ }+ )+ }+ >+ Show reminder+ </Button></div><p class="mt-5 text-sm text-ink-muted">{selected()} — this preview does not save data.</p>+ <p>Dismissals: {dismissals()}</p><div class="mt-6"><Tabsaria-label="Channel views"diff --git a/apps/web/src/features/task-composer/primitives/task-composer.ts b/apps/web/src/features/task-composer/primitives/task-composer.tsindex 24457e5a8b..eedc0fc98c 100644--- a/apps/web/src/features/task-composer/primitives/task-composer.ts+++ b/apps/web/src/features/task-composer/primitives/task-composer.ts@@ -28,6 +28,7 @@ import { initializeEditorEmpty } from '@core/component/LexicalMarkdown/utils';import type { PortalScope } from '@core/component/ScopedPortal';import { toast } from '@core/component/Toast/Toast';import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';+import { isTouchDevice } from '@core/mobile/isTouchDevice';import { fireAndForget } from '@core/util/fireAndForget';import { buildSimpleEntityUrl } from '@core/util/url';import ArrowSquareOutIcon from '@icon/system/regular/arrow-square-out.svg';@@ -348,21 +349,27 @@ export function createTaskComposer(}const task = { id: documentId, optimisticSnapshot };- toast.success('Task created', {+ const openTask = (newSplit: boolean) => {+ if (toastId !== undefined) toast.dismiss(toastId);+ host.openTask(task, { newSplit, referredFrom: null });+ };+ const toastId = toast.success('Task created', {subtext: linkCopied ? 'Link copied' : undefined,actions: [{label: 'Open',icon: ArrowSquareOutIcon,- onClick: () =>- host.openTask(task, { newSplit: false, referredFrom: null }),- },- {- label: 'Open (New Split)',- icon: SplitIcon,- onClick: () =>- host.openTask(task, { newSplit: true, referredFrom: null }),+ onClick: () => openTask(false),},+ ...(!isTouchDevice()+ ? [+ {+ label: 'Open (New Split)',+ icon: SplitIcon,+ onClick: () => openTask(true),+ },+ ]+ : []),],});};diff --git a/apps/web/src/lib/core/component/Toast/Toast.test.tsx b/apps/web/src/lib/core/component/Toast/Toast.test.tsxindex 95cd5b62c3..7f935a7ba7 100644--- a/apps/web/src/lib/core/component/Toast/Toast.test.tsx+++ b/apps/web/src/lib/core/component/Toast/Toast.test.tsx@@ -150,7 +150,7 @@ it('keeps only the latest transient notice on mobile', () => {expect(screen.getByText('Latest mobile notice')).toBeTruthy();});-it('keeps mobile prompt descriptions and close actions accessible', () => {+it('keeps mobile prompt descriptions accessible', () => {mobile.value = true;render(() => <ToastRegion />);toast.custom(@@ -158,5 +158,4 @@ it('keeps mobile prompt descriptions and close actions accessible', () => {{ persistent: true });expect(screen.getByText('Helpful details')).toBeTruthy();- expect(screen.getByRole('button', { name: 'Close' })).toBeTruthy();});diff --git a/apps/web/src/lib/core/component/Toast/Toast.tsx b/apps/web/src/lib/core/component/Toast/Toast.tsxindex 7f9dfdab4a..a9eb4d51e3 100644--- a/apps/web/src/lib/core/component/Toast/Toast.tsx+++ b/apps/web/src/lib/core/component/Toast/Toast.tsx@@ -297,16 +297,18 @@ function ToastContent(props: {<ActionButtons actions={actions()!} /></div></Show>- <Toast.CloseButton- as={Button}- variant="ghost"- size="icon-xs"- aria-label="Close"- class="macro-toast-corner-close shrink-0"- onClick={() => props.onUserDismiss?.()}- >- <XIcon class="size-2.5" />- </Toast.CloseButton>+ <Show when={!isMobile()}>+ <Toast.CloseButton+ as={Button}+ variant="ghost"+ size="icon-xs"+ aria-label="Close"+ class="macro-toast-corner-close shrink-0"+ onClick={() => props.onUserDismiss?.()}+ >+ <XIcon class="size-2.5" />+ </Toast.CloseButton>+ </Show></div></div></Toast>diff --git a/apps/web/src/lib/core/component/Toast/ToastRegion.tsx b/apps/web/src/lib/core/component/Toast/ToastRegion.tsxindex 29ca4da718..1b724489ca 100644--- a/apps/web/src/lib/core/component/Toast/ToastRegion.tsx+++ b/apps/web/src/lib/core/component/Toast/ToastRegion.tsx@@ -1,10 +1,18 @@import { UploadProgressIndicator } from '@core/component/UploadProgress/UploadProgressIndicator';import { isMobile } from '@core/mobile/isMobile';import { Toast } from '@kobalte/core/toast';-import { Show } from 'solid-js';+import { createSignal, Show } from 'solid-js';import { Portal } from 'solid-js/web';export function ToastRegion() {+ const [mobileSwipeDirection, setMobileSwipeDirection] = createSignal<+ 'left' | 'right'+ >('left');+ let swipeStart: { x: number; pointerId: number } | undefined;+ const clearSwipe = (event: PointerEvent) => {+ if (swipeStart?.pointerId === event.pointerId) swipeStart = undefined;+ };+return (<Portal>{/*@@ -56,6 +64,25 @@ export function ToastRegion() {*/}<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-5"+ on:pointerdown={{+ capture: true,+ handleEvent: (event) => {+ if (event.button === 0)+ swipeStart = { x: event.clientX, pointerId: event.pointerId };+ },+ }}+ on:pointermove={{+ capture: true,+ handleEvent: (event) => {+ if (!swipeStart || swipeStart.pointerId !== event.pointerId) return;+ const deltaX = event.clientX - swipeStart.x;+ // Choose the direction before Kobalte clamps this pointer move.+ if (deltaX !== 0)+ setMobileSwipeDirection(deltaX < 0 ? 'left' : 'right');+ },+ }}+ on:pointerup={{ capture: true, handleEvent: clearSwipe }}+ on:pointercancel={{ capture: true, handleEvent: clearSwipe }}style={{bottom: 'calc(var(--mobile-content-inset-bottom, 0px) + 12px)',}}@@ -66,7 +93,7 @@ export function ToastRegion() {duration={Infinity}limit={1}pauseOnInteraction={false}- swipeDirection="left"+ swipeDirection={mobileSwipeDirection()}><Toast.List class="macro-toast-list" /></Toast.Region>@@ -76,7 +103,7 @@ export function ToastRegion() {duration={Infinity}limit={1}pauseOnInteraction={false}- swipeDirection="left"+ swipeDirection={mobileSwipeDirection()}><Toast.List class="macro-toast-list" /></Toast.Region>@@ -86,7 +113,7 @@ export function ToastRegion() {limit={1}duration={4500}pauseOnInteraction- swipeDirection="left"+ swipeDirection={mobileSwipeDirection()}><Toast.List class="macro-toast-list" /></Toast.Region>diff --git a/docs/agent-guide/tasks.md b/docs/agent-guide/tasks.mdindex 587bfaec83..055edefe32 100644--- a/docs/agent-guide/tasks.md+++ b/docs/agent-guide/tasks.md@@ -610,6 +610,13 @@ the centered composer dialog. Both layouts are views in`apps/web/src/features/task-composer/views` composing the shared`TaskComposer` parts.+After creation, the `Task created` toast shows `Link copied` when copying+succeeds and an `Open` action. Touch devices omit `Open (New Split)`; desktop+keeps both actions. Either action immediately dismisses the toast before opening+the task. Verify the toast at phone and tablet widths with touch+emulation: the message and action fit without clipping, and `Open` visits the+created task in place.+1. Click the `Task` button (or `Create` → `Task T`, or keyboard `c` then `t`).2. A dialog opens with the title contenteditable focused (placeholder `New task`), plus`Add description...`, and property buttons: `Not Started` (status), `Priority`, assignee