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(channels): keep list previews inert and accessible (#8282)
Peter Chinmanc5cba0065f1b
diff --git a/apps/web/src/features/entity/composed/list-entity/channel.tsx b/apps/web/src/features/entity/composed/list-entity/channel.tsxindex c0b69c2bc7..75ae959240 100644--- a/apps/web/src/features/entity/composed/list-entity/channel.tsx+++ b/apps/web/src/features/entity/composed/list-entity/channel.tsx@@ -77,6 +77,7 @@ function ChannelMessage(props: {fallback={<span class="italic">Attached Items</span>}><StaticMarkdown+ inerttheme={singleLineMarkdownTheme}markdown={props.message.content}singleLine@@ -161,6 +162,7 @@ export function ChannelLatestMessageNarrowBody(props: {<DisplayName id={props.message.senderId} format="firstName" />:{' '}</span><StaticMarkdown+ inerttheme={twoLineClampMarkdownTheme}markdown={props.message.content.trim()}singleLinediff --git a/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx b/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsxindex 1f7770da26..b2af2ed5c0 100644--- a/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx+++ b/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx@@ -587,6 +587,7 @@ function CardMarkdownLine(props: { text?: string; class?: string }) {*/function CardClampedMarkdown(props: {text?: string;+ inert?: boolean;/** Inline run rendered ahead of the text (e.g. a sender label or* attachment paperclip); wraps and clamps as part of the same lines. */prefix?: JSX.Element;@@ -600,6 +601,7 @@ function CardClampedMarkdown(props: {markdown={value()}singleLinetheme={inlineWrappingMarkdownTheme}+ inert={props.inert}/>)}</Show>@@ -706,6 +708,7 @@ export function ChannelCardLayout(props: InboxCardLayoutProps) {title={text().title}><CardClampedMarkdown+ inerttext={text().content}prefix={<>@@ -751,7 +754,7 @@ export function ChannelMessageCardLayout(props: InboxCardLayoutProps) {icon={<ActionBubble tag={getNotificationTag(props.item.notification)} />}title={text().title}>- <CardClampedMarkdown text={text().content} />+ <CardClampedMarkdown inert text={text().content} /></BaseCard>);}@@ -904,6 +907,7 @@ export function ChannelThreadCardLayout(props: InboxCardLayoutProps) {<PaperclipIcon class="mr-0.5 inline size-3.5 align-[-0.125em]" /></Show><StaticMarkdown+ inertmarkdown={context()}singleLinetheme={unifiedListMarkdownTheme}@@ -929,6 +933,7 @@ export function ChannelThreadCardLayout(props: InboxCardLayoutProps) {<PaperclipIcon class="mr-0.5 inline size-3.5 align-[-0.125em]" /></Show><StaticMarkdown+ inertmarkdown={value()}singleLinetheme={diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/core/StaticMarkdown.test.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/StaticMarkdown.test.tsxindex b9c98c7c7f..4b830721ad 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/core/StaticMarkdown.test.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/StaticMarkdown.test.tsx@@ -188,6 +188,33 @@ describe('static agent session previews', () => {});});+describe('display-only markdown previews', () => {+ it('keeps formatted message text and mention names outside the inert subtree', () => {+ const [markdown, setMarkdown] = createSignal(+ 'Review **the plan** with <m-document-mention>{"documentId":"plan-1","documentName":"Launch plan","blockName":"md","blockParams":{}}</m-document-mention>'+ );+ const rendered = render(() => (+ <StaticMarkdownContext>+ <StaticMarkdown inert markdown={markdown()} singleLine />+ </StaticMarkdownContext>+ ));++ const accessibleText = rendered.getByText(+ 'Review the plan with Launch plan'+ );+ expect(accessibleText.closest('[inert], [aria-hidden="true"]')).toBeNull();++ setMarkdown('Updated **plan**');+ expect(rendered.queryByText('Review the plan with Launch plan')).toBeNull();+ expect(+ rendered+ .getByText('Updated plan')+ .closest('[inert], [aria-hidden="true"]')+ ).toBeNull();+ rendered.unmount();+ });+});+describe('static pull request mentions', () => {it.each([[diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/core/StaticMarkdown.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/StaticMarkdown.tsxindex 1c87ca4a9f..15c8282e93 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/core/StaticMarkdown.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/StaticMarkdown.tsx@@ -1118,23 +1118,34 @@ function Document(theme: EditorThemeClasses;rootRef?: (ref: HTMLDivElement) => void;singleLine?: boolean;+ inert?: boolean;} & StaticRenderOptions): JSX.Element {+ // Read while the parsed editor state is active, before rendering decorators.+ const accessibleText = props.inert+ ? props.rootNode.getTextContent()+ : undefined;return (- <div- class={cn(- 'markdown-content',- props.theme.root,- 'wrap-break-word max-w-full'- )}- ref={props.rootRef}- >- <MapRender- children={props.rootNode.getChildren()}- theme={props.theme}- lazy={props.lazy}- />- </div>+ <>+ <Show when={props.inert}>+ <span class="sr-only">{accessibleText}</span>+ </Show>+ <div+ class={cn(+ 'markdown-content',+ props.theme.root,+ 'wrap-break-word max-w-full'+ )}+ ref={props.rootRef}+ inert={props.inert}+ >+ <MapRender+ children={props.rootNode.getChildren()}+ theme={props.theme}+ lazy={props.lazy}+ />+ </div>+ </>);}@@ -1179,6 +1190,8 @@ export function StaticMarkdown(props: {target?: 'internal' | 'external' | 'both';singleLine?: boolean;lazy?: boolean;+ /** Disable preview interactions while exposing a plain-text equivalent to assistive technology. */+ inert?: boolean;}) {let {editor: contextEditor,@@ -1272,6 +1285,7 @@ export function StaticMarkdown(props: {theme: mergedTheme(),lazy: lazy(),rootRef: props.rootRef,+ inert: props.inert,});});});diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/README.md b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/README.mdnew file mode 100644index 0000000000..f8f740407d--- /dev/null+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/README.md@@ -0,0 +1,22 @@+# Channel preview browser regression++From `apps/web`, run:++```sh+bunx playwright test --config src/lib/core/component/LexicalMarkdown/component/core/browser-test/playwright.config.ts+```++Install Playwright Chromium first, or set `PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH`+to an existing Chromium/Chrome executable. `MARKDOWN_PREVIEW_TEST_PORT` overrides+port 3005; the harness owns and stops its Vite server.++The fixture mounts the production wide/narrow channel row content and Home card+layouts over synthetic data. It blocks hosted API traffic. Desktop, tablet touch,+and phone touch checks verify the browser's native accessibility tree, pointer+activation of the owning row, Tab navigation, and interactive conversation links+and mentions. DOM-derived ARIA snapshots do not model `inert`, so accessibility+assertions use Chromium's native CDP tree. This is component integration coverage,+not authenticated app navigation or a VoiceOver session.++Screenshots from the verified fixture: [desktop](proof/desktop.png) and+[phone](proof/mobile.png).diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/playwright.config.ts b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/playwright.config.tsnew file mode 100644index 0000000000..c98244f08d--- /dev/null+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/playwright.config.ts@@ -0,0 +1,34 @@+import { fileURLToPath } from 'node:url';+import { defineConfig, devices } from '@playwright/test';++const port = process.env.MARKDOWN_PREVIEW_TEST_PORT ?? '3005';+export default defineConfig({+ testDir: fileURLToPath(new URL('.', import.meta.url)),+ testMatch: '*.browser.e2e.ts',+ workers: 1,+ timeout: 120_000,+ use: {+ baseURL: `http://localhost:${port}`,+ launchOptions: {+ executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH,+ },+ },+ projects: [+ { name: 'desktop', use: { viewport: { width: 1280, height: 900 } } },+ {+ name: 'tablet',+ use: { viewport: { width: 1024, height: 900 }, hasTouch: true },+ },+ {+ name: 'mobile',+ use: { ...devices['iPhone 13'], defaultBrowserType: 'chromium' },+ },+ ],+ webServer: {+ command: `MACRO_DEV_HTTPS=false bunx vite --port ${port} --strictPort`,+ cwd: fileURLToPath(new URL('../../../../../../../../', import.meta.url)),+ url: `http://localhost:${port}/app/`,+ reuseExistingServer: false,+ timeout: 60_000,+ },+});diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/preview.browser.e2e.ts b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/preview.browser.e2e.tsnew file mode 100644index 0000000000..f8ce605270--- /dev/null+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/preview.browser.e2e.ts@@ -0,0 +1,126 @@+import { expect, test } from '@playwright/test';++test('previews expose text once, route clicks to their row, and skip embedded controls', async ({+ page,+ context,+}, testInfo) => {+ // Render production components over synthetic props; no hosted data is read or written.+ await page.route('**/*', async (route) => {+ const url = new URL(route.request().url());+ if (+ url.hostname === 'localhost' &&+ !url.pathname.includes('/__macro_dev/')+ ) {+ await route.continue();+ } else {+ await route.fulfill({+ status:+ url.hostname === 'example.com' || url.pathname.includes('unfurl')+ ? 200+ : 401,+ contentType: 'application/json',+ body: JSON.stringify({ responses: [] }),+ });+ }+ });+ const errors: string[] = [];+ page.on('pageerror', (error) => errors.push(error.message));+ await page.routeWebSocket('**/*', (socket) => socket.close());+ await page.goto(+ '/src/lib/core/component/LexicalMarkdown/component/core/browser-test/preview.html'+ );+ const text = 'Read Roadmap with Alex';+ let openCount = 0;+ const cdp = await context.newCDPSession(page);+ const layouts =+ testInfo.project.name === 'mobile'+ ? ['narrow', 'channel', 'message', 'thread']+ : ['wide', 'narrow', 'channel', 'message', 'thread'];+ for (const id of layouts) {+ const row = page.getByTestId(id).getByRole('button').first();+ await expect(row).toBeVisible({ timeout: 30_000 });+ // Read Chromium's accessibility tree: DOM-based role queries don't model inert.+ const cdpDocument = await cdp.send('DOM.getDocument');+ const { nodeId } = await cdp.send('DOM.querySelector', {+ nodeId: cdpDocument.root.nodeId,+ selector: `[data-testid="${id}"] [role="button"]`,+ });+ const { nodes } = await cdp.send('Accessibility.getPartialAXTree', {+ nodeId,+ fetchRelatives: false,+ });+ const accessibleName = nodes[0].name?.value ?? '';+ expect(accessibleName.split(text).length - 1).toBe(id === 'thread' ? 2 : 1);+ expect(accessibleName).not.toContain('<m-');+ const accessibility = await cdp.send('Accessibility.getFullAXTree');+ expect(+ accessibility.nodes.filter(+ (node) =>+ !node.ignored &&+ node.role?.value === 'link' &&+ node.name?.value === 'Roadmap'+ )+ ).toHaveLength(1);+ const previews = page.getByTestId(id).locator('.markdown-content');+ for (const preview of await previews.all()) {+ for (const target of [+ preview.locator('a'),+ preview.locator('[data-user-mention]'),+ ]) {+ await target.scrollIntoViewIfNeeded();+ const bounds = await target.boundingBox();+ expect(bounds).not.toBeNull();+ if (!bounds) throw new Error('Preview target has no bounds');+ if (testInfo.project.use.hasTouch) {+ await page.touchscreen.tap(+ bounds.x + bounds.width / 2,+ bounds.y + bounds.height / 2+ );+ } else {+ await page.mouse.click(+ bounds.x + bounds.width / 2,+ bounds.y + bounds.height / 2+ );+ }+ openCount += 1;+ await expect(page.getByRole('status')).toHaveText(+ `Opened: ${id} (${openCount})`+ );+ expect(context.pages()).toHaveLength(1);+ }+ }+ await row.focus();+ await page.keyboard.press('Tab');+ expect(+ await page+ .getByTestId(id)+ .evaluate((el) => el.contains(document.activeElement))+ ).toBe(false);+ }+ const conversation = page.getByTestId('conversation');+ const link = conversation.getByRole('link', { name: 'Roadmap' });+ await expect(link).toBeVisible();+ await link.focus();+ await expect(link).toBeFocused();+ const popupPromise = page.waitForEvent('popup');+ await page.keyboard.press('Enter');+ const popup = await popupPromise;+ await expect(popup).toHaveURL('https://example.com/roadmap');+ await popup.close();+ await link.focus();+ await page.keyboard.press('Tab');+ expect(+ await conversation+ .locator('[data-user-mention]')+ .evaluate((element) => document.activeElement?.contains(element))+ ).toBe(true);+ // Reset horizontal scroll caused by revealing clipped preview targets.+ await page.locator('*').evaluateAll((elements) => {+ for (const element of elements) element.scrollLeft = 0;+ });+ expect(errors).toEqual([]);+ await page.screenshot({+ path: testInfo.outputPath('previews.png'),+ fullPage: true,+ });+});diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/preview.html b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/preview.htmlnew file mode 100644index 0000000000..b3beb83dbd--- /dev/null+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/preview.html@@ -0,0 +1,5 @@+<!doctype html>+<html lang="en">+ <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Channel preview accessibility</title></head>+ <body><div id="root"></div><script type="module" src="./preview.tsx"></script></body>+</html>diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/preview.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/preview.tsxnew file mode 100644index 0000000000..a4681d5e00--- /dev/null+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/preview.tsx@@ -0,0 +1,165 @@+import '@app/index.css';+import { InboxCard } from '@app/features/next-soup/soup-view/views/inbox/InboxCard';+import {+ ChannelCardLayout,+ ChannelMessageCardLayout,+ ChannelThreadCardLayout,+} from '@app/features/next-soup/soup-view/views/inbox/inbox-card-layouts';+import { AnalyticsContextProvider } from '@app/lib/analytics/analytics-context';+import { PosthogProvider } from '@app/lib/analytics/posthog';+import { UserContextProvider } from '@core/context/user';+import { isTouchDevice } from '@core/mobile/isTouchDevice';+import {+ ChannelLatestMessageNarrowBody,+ ChannelWideContent,+} from '@entity/composed/list-entity/channel';+import type {+ ChannelEntity,+ ChannelMessageEntity,+ ChannelThreadEntity,+} from '@entity/types/entity';+import type { Notification } from '@entity/types/notification';+import { QueryClient, QueryClientProvider } from '@tanstack/solid-query';+import { createSignal, onCleanup } from 'solid-js';+import { render } from 'solid-js/web';+import { StaticMarkdown, StaticMarkdownContext } from '../StaticMarkdown';++const content =+ '**Read** [Roadmap](https://example.com/roadmap) with <m-user-mention>{"userId":"preview-user","email":"[email protected]","displayName":"Alex"}</m-user-mention>';+const message = {+ messageId: 'preview-message',+ content,+ senderId: 'preview-user',+ createdAt: '2026-10-19T12:00:00Z',+ mentions: [],+};+const channel: ChannelEntity = {+ id: 'preview-channel',+ name: 'Preview channel',+ ownerId: 'preview-user',+ type: 'channel',+ channelType: 'public',+ latestMessage: message,+ latestRootMessage: message,+};+const channelMessage: ChannelMessageEntity = {+ id: 'preview-message',+ name: 'Preview channel',+ ownerId: 'preview-user',+ type: 'channel_message',+ channelId: channel.id,+ channelName: channel.name,+ channelType: 'public',+ messageId: message.messageId,+ senderId: message.senderId,+ content,+};+const thread: ChannelThreadEntity = {+ id: 'preview-thread',+ name: 'Preview channel',+ ownerId: 'preview-user',+ type: 'channel_thread',+ channelId: channel.id,+ channelType: 'public',+ messageId: message.messageId,+ threadId: 'preview-thread',+ senderId: message.senderId,+ sender: { type: 'user', id: 'preview-user' },+ content: `Original ${content}`,+ attachments: [],+ reactions: [],+ thread: { replyCount: 1, preview: [] },+};+const notification: Notification = {+ id: 'preview-notification',+ entity_id: channel.id,+ entity_type: 'channel',+ created_at: message.createdAt,+ updated_at: message.createdAt,+ sent: true,+ state: 'unseen',+ sender_id: message.senderId,+ notification_event_type: 'channel_message_reply',+ notification_metadata: {+ tag: 'channel_message_reply',+ content: {+ channelName: channel.name,+ channelType: 'public',+ messageId: 'preview-reply',+ threadId: thread.threadId,+ messageContent: content,+ },+ },+};++function Fixture() {+ document.documentElement.dataset.touchDevice = String(isTouchDevice());+ const client = new QueryClient({+ defaultOptions: { queries: { retry: false } },+ });+ onCleanup(() => client.clear());+ const [opened, setOpened] = createSignal('None');+ const [openCount, setOpenCount] = createSignal(0);+ const open = (id: string) => {+ setOpened(id);+ setOpenCount((count) => count + 1);+ };+ return (+ <AnalyticsContextProvider>+ <PosthogProvider>+ <QueryClientProvider client={client}>+ <UserContextProvider>+ <StaticMarkdownContext>+ <main+ class="p-4 bg-page text-ink space-y-4"+ style={{+ '--title-width': '160px',+ '--soup-row-padding-l': '8px',+ }}+ >+ <h1>Channel preview accessibility</h1>+ <div data-testid="wide" class="mobile:hidden">+ <InboxCard.Root class="flex" onClick={() => open('wide')}>+ <ChannelWideContent entity={channel} showLatestMessage />+ </InboxCard.Root>+ </div>+ <div data-testid="narrow">+ <InboxCard.Root class="block" onClick={() => open('narrow')}>+ <ChannelLatestMessageNarrowBody message={message} />+ </InboxCard.Root>+ </div>+ <div data-testid="channel">+ <ChannelCardLayout+ item={{ entity: channel, unread: true }}+ onClick={() => open('channel')}+ />+ </div>+ <div data-testid="message">+ <ChannelMessageCardLayout+ item={{ entity: channelMessage, unread: true }}+ onClick={() => open('message')}+ />+ </div>+ <div data-testid="thread">+ <ChannelThreadCardLayout+ item={{ entity: thread, notification, unread: true }}+ onClick={() => open('thread')}+ />+ </div>+ <p role="status">+ Opened: {opened()} ({openCount()})+ </p>+ <h2>Opened conversation</h2>+ <div data-testid="conversation">+ <StaticMarkdown markdown={content} />+ </div>+ </main>+ </StaticMarkdownContext>+ </UserContextProvider>+ </QueryClientProvider>+ </PosthogProvider>+ </AnalyticsContextProvider>+ );+}++render(() => <Fixture />, document.getElementById('root')!);diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/proof/desktop.png b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/proof/desktop.pngnew file mode 100644index 0000000000..17a618899cBinary files /dev/null and b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/proof/desktop.png differdiff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/proof/mobile.png b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/proof/mobile.pngnew file mode 100644index 0000000000..39d2d58614Binary files /dev/null and b/apps/web/src/lib/core/component/LexicalMarkdown/component/core/browser-test/proof/mobile.png differdiff --git a/docs/agent-guide/channels.md b/docs/agent-guide/channels.mdindex e6fb9a936c..4b54d96361 100644--- a/docs/agent-guide/channels.md+++ b/docs/agent-guide/channels.md@@ -1,5 +1,14 @@# Channels and Messaging+## Channel list previews++Message text in channel rows and Home cards is display-only, including quoted+thread previews. Clicking a link or mention in that text opens the surrounding+channel or thread, and Tab skips embedded controls. Screen readers still announce+the message text, including link labels and mention names, once per preview.+Verify wide and narrow rows and channel/thread cards; links and mentions remain+interactive inside the opened conversation.+## Create a channel1. `Create` → `Channel G`. Dialog `Create a channel` opens on step 1 of 3 with the `Name` textbox focused.