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(mentions): keep intra-channel mention navigation in place on mobile (#3592)
Peter Chinman8561a06e99b9
diff --git a/js/app/packages/core/util/openInNewSplit.test.ts b/js/app/packages/core/util/openInNewSplit.test.tsindex 4d843befea..32b02d9742 100644--- a/js/app/packages/core/util/openInNewSplit.test.ts+++ b/js/app/packages/core/util/openInNewSplit.test.ts@@ -1,7 +1,16 @@-import { describe, expect, it } from 'vitest';+import { isMobile } from '@core/mobile/isMobile';+import { afterEach, describe, expect, it, vi } from 'vitest';import { openInNewSplitForMention } from './openInNewSplit';+vi.mock('@core/mobile/isMobile', () => ({+ isMobile: vi.fn(() => false),+}));+describe('openInNewSplitForMention', () => {+ afterEach(() => {+ vi.mocked(isMobile).mockReturnValue(false);+ });+it('opens in a new split by default for mouse/keyboard interactions', () => {expect(openInNewSplitForMention(false, true)).toBe(true);});@@ -13,4 +22,9 @@ describe('openInNewSplitForMention', () => {it('defaults to current split when there is no event (e.g. touch)', () => {expect(openInNewSplitForMention(undefined, false)).toBe(false);});++ it('always opens in the current split on mobile', () => {+ vi.mocked(isMobile).mockReturnValue(true);+ expect(openInNewSplitForMention(false, true)).toBe(false);+ });});diff --git a/js/app/packages/core/util/openInNewSplit.ts b/js/app/packages/core/util/openInNewSplit.tsindex a216a4855b..20588ce94c 100644--- a/js/app/packages/core/util/openInNewSplit.ts+++ b/js/app/packages/core/util/openInNewSplit.ts@@ -1,3 +1,5 @@+import { isMobile } from '@core/mobile/isMobile';+/*** Macro uses "splits" as its tab-like navigation concept.*@@ -5,12 +7,15 @@* - default click/enter: open in a new split* - holding Option (alt): open in the current split*- * We also want touch opens (which typically call handlers without a keyboard/mouse- * event) to remain in the current split to avoid surprising split creation.+ * We also want touch opens to remain in the current split to avoid surprising+ * split creation. The call-site `e != null` heuristic can't detect touch on+ * iOS WKWebView (taps fire real mouse events), so guard on `isMobile()` here —+ * mobile has no split concept and navigates in place / via forward navigation.*/export function openInNewSplitForMention(altKey: boolean | undefined,defaultOpenInNewSplit: boolean): boolean {+ if (isMobile()) return false;return altKey ? false : defaultOpenInNewSplit;}