Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(comments): stop a document row from opening its comment drawer on mobile (#7328)

Peter Chinmand59ccd4fa52d
diff --git a/apps/web/src/features/next-soup/utils.test.ts b/apps/web/src/features/next-soup/utils.test.ts
index 41c910f803..bd58f3b99f 100644
--- a/apps/web/src/features/next-soup/utils.test.ts
+++ b/apps/web/src/features/next-soup/utils.test.ts
@@ -2321,6 +2321,30 @@ describe('getDocumentCommentTarget', () => {
});
});
+ it('opens the document itself on touch, where the thread covers it', async () => {
+ vi.mocked(isTouchDevice).mockReturnValue(true);
+ const openWithSplit = vi.fn(() => ({ status: 'unavailable' }));
+ const goToLocationFromParams = vi.fn();
+ const getBlockHandle = vi.fn(async () => ({ goToLocationFromParams }));
+ setGlobalSplitManager({
+ activeSplit: vi.fn(),
+ getOrchestrator: vi.fn(() => ({ getBlockHandle })),
+ getSplitByContent: vi.fn(),
+ openWithSplit,
+ } as unknown as SplitManager);
+
+ await openEntityInSplitFromUnifiedList(
+ documentRow([commentNotification('n1', 'comment-1')]),
+ {}
+ );
+
+ expect(openWithSplit).toHaveBeenCalledWith(
+ { type: 'md', id: 'doc-1', params: undefined },
+ expect.objectContaining({ activate: true })
+ );
+ expect(goToLocationFromParams).not.toHaveBeenCalled();
+ });
+
it('carries the comment through the Inbox preview route', () => {
const result = homePreviewNavigation(
documentRow([commentNotification('n1', 'comment-1')]) as never
diff --git a/apps/web/src/features/next-soup/utils.ts b/apps/web/src/features/next-soup/utils.ts
index 67d366331c..c372ea6040 100644
--- a/apps/web/src/features/next-soup/utils.ts
+++ b/apps/web/src/features/next-soup/utils.ts
@@ -730,8 +730,13 @@ export const openEntityInSplitFromUnifiedList = async (
threadId: channelMessageTarget.threadId,
}
: undefined);
+ // A row keeps pointing at its comment notification until that notification is
+ // done, so on touch — where the thread is a drawer over the whole page, not a
+ // margin card beside the text — the row would cover the document with the
+ // same comment on every open. A tap on a document row asks for the document;
+ // the notification list still opens the comment itself.
const commentParams =
- !target && entity.type === 'document'
+ !target && entity.type === 'document' && !isTouchDevice()
? getDocumentCommentTarget(entity)?.params
: undefined;
diff --git a/docs/agent-guide/documents.md b/docs/agent-guide/documents.md
index f5964129b0..ab451b915c 100644
--- a/docs/agent-guide/documents.md
+++ b/docs/agent-guide/documents.md
@@ -2583,6 +2583,15 @@ editor and comments arriving after it. Once loaded, click elsewhere in the
document, then click the same notification again: it should revisit the comment,
while background comment refreshes should leave the user's position alone.
+A document row keeps pointing at its newest comment notification until that
+notification is done, so on desktop the row opens the document at that comment.
+On touch the thread is a drawer over the whole page rather than a margin card,
+so a row tap opens the document itself: no drawer, with the comment's highlight
+still in the text. Verify this from Home, Inbox, and Files with a comment
+notification that has already been read — the drawer must not reappear on every
+open. Tapping the highlighted text still offers `Show comment`, and opening the
+notification itself still opens the thread.
+
When checking desktop margin placement, scroll a long document while an embed
or image above the highlighted text changes height. Scroll anchoring may keep
the text at the same screen position; its comment card should stay aligned