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
feat(email): separate Tab navigation from number key shortcuts (#8904)
Jacob Beckerman08be00ba9a3d
diff --git a/apps/web/src/components/view-shell/use-view-tab-hotkeys.test.ts b/apps/web/src/components/view-shell/use-view-tab-hotkeys.test.tsindex f36cd8a209..f9889bfc6d 100644--- a/apps/web/src/components/view-shell/use-view-tab-hotkeys.test.ts+++ b/apps/web/src/components/view-shell/use-view-tab-hotkeys.test.ts@@ -1,5 +1,5 @@import { registerHotkey } from '@core/hotkey/hotkeys';-import { createRoot } from 'solid-js';+import { createRoot, createSignal } from 'solid-js';import { expect, it, vi } from 'vitest';import { useViewTabHotkeys } from './use-view-tab-hotkeys';@@ -8,6 +8,12 @@ vi.mock('@core/hotkey/hotkeys', () => ({createHotkeyGroup: () => ({ dispose: vi.fn() }),}));+const handler = (key: string) =>+ vi+ .mocked(registerHotkey)+ .mock.calls.findLast(([options]) => options.hotkey === key)![0]+ .keyDownHandler!;+it('leaves guarded native Tab events alone while retaining programmatic and numbered view navigation', () => {createRoot((dispose) => {const move = vi.fn();@@ -19,11 +25,6 @@ it('leaves guarded native Tab events alone while retaining programmatic and numbsetActiveId: move,shouldHandleSequentialKeyEvent: (event) => event !== nativeEvent,});- const handler = (key: string) =>- vi- .mocked(registerHotkey)- .mock.calls.find(([options]) => options.hotkey === key)![0]- .keyDownHandler!;expect(handler('tab')(nativeEvent)).toBe(false);expect(handler('shift+tab')(nativeEvent)).toBe(false);expect(move).not.toHaveBeenCalled();@@ -34,3 +35,33 @@ it('leaves guarded native Tab events alone while retaining programmatic and numbdispose();});});++it('cycles Tab through sequential ids while number keys keep every tab', () => {+ createRoot((dispose) => {+ const move = vi.fn();+ const [active, setActive] = createSignal('sent');+ useViewTabHotkeys({+ scopeId: 'email',+ ids: () => ['important', 'favorites', 'sent'],+ sequentialIds: () => ['important', 'noise'],+ activeId: active,+ setActiveId: move,+ });+ expect(handler('tab')()).toBe(true);+ expect(move).toHaveBeenLastCalledWith('important');+ setActive('important');+ expect(handler('tab')()).toBe(true);+ expect(move).toHaveBeenLastCalledWith('noise');+ setActive('noise');+ expect(handler('tab')()).toBe(true);+ expect(move).toHaveBeenLastCalledWith('important');+ expect(handler('shift+tab')()).toBe(true);+ expect(move).toHaveBeenLastCalledWith('important');+ setActive('sent');+ expect(handler('shift+tab')()).toBe(true);+ expect(move).toHaveBeenLastCalledWith('noise');+ expect(handler('3')()).toBe(true);+ expect(move).toHaveBeenLastCalledWith('sent');+ dispose();+ });+});diff --git a/apps/web/src/components/view-shell/use-view-tab-hotkeys.ts b/apps/web/src/components/view-shell/use-view-tab-hotkeys.tsindex 1705751fae..18bd3f865c 100644--- a/apps/web/src/components/view-shell/use-view-tab-hotkeys.ts+++ b/apps/web/src/components/view-shell/use-view-tab-hotkeys.ts@@ -5,6 +5,8 @@ import { onCleanup } from 'solid-js';export type UseViewTabHotkeysOptions<TTab extends string> = {scopeId: string;ids: () => readonly TTab[];+ /** Tabs that Tab and Shift+Tab cycle through; defaults to `ids`. */+ sequentialIds?: () => readonly TTab[];activeId: () => TTab;setActiveId: (id: TTab) => void;enabled?: () => boolean;@@ -39,8 +41,10 @@ export function useViewTabHotkeys<TTab extends string>(}).withGroup(group);});+ const sequentialIds = () => options.sequentialIds?.() ?? options.ids();+const move = (offset: 1 | -1) => {- const ids = options.ids();+ const ids = sequentialIds();if (ids.length < 2) return false;const currentIndex = ids.indexOf(options.activeId());@@ -62,7 +66,7 @@ export function useViewTabHotkeys<TTab extends string>(hotkeyToken: TOKENS.soup.tabs.next,scopeId: options.scopeId,description: 'Next tab',- condition: () => isEnabled() && options.ids().length > 1,+ condition: () => isEnabled() && sequentialIds().length > 1,keyDownHandler: (event) =>options.shouldHandleSequentialKeyEvent?.(event) === false? false@@ -74,7 +78,7 @@ export function useViewTabHotkeys<TTab extends string>(hotkeyToken: TOKENS.soup.tabs.prev,scopeId: options.scopeId,description: 'Previous tab',- condition: () => isEnabled() && options.ids().length > 1,+ condition: () => isEnabled() && sequentialIds().length > 1,keyDownHandler: (event) =>options.shouldHandleSequentialKeyEvent?.(event) === false? falsediff --git a/apps/web/src/features/email-view/components/EmailSidebar.tsx b/apps/web/src/features/email-view/components/EmailSidebar.tsxindex de0a713d08..c9fe3c73dc 100644--- a/apps/web/src/features/email-view/components/EmailSidebar.tsx+++ b/apps/web/src/features/email-view/components/EmailSidebar.tsx@@ -36,6 +36,10 @@ import { EmailInboxList } from './EmailInboxSelector';// Email is personal, so the sidebar lists only the user's own tags.const SIDEBAR_TAG_SCOPES: readonly TagScope[] = ['user'];+const INBOX_TAB_IDS = [+ 'important',+ 'noise',+] as const satisfies readonly EmailTab[];const PRIMARY_TAB_IDS = ['favorites','drafts',@@ -167,18 +171,22 @@ export function EmailSidebar() {setSidebarSectionOpen,} = useEmailView();+ const tabIds = () =>+ (isTouchDevice() ? EMAIL_TAB_IDS : DESKTOP_TAB_IDS).filter(+ (id) =>+ id !== 'reminders' ||+ reminders().enabled ||+ (reminders().loading && state.tab === 'reminders')+ );+useViewTabHotkeys({scopeId: panel.splitHotkeyScope,enabled: panel.isPanelActive,- ids: () =>- (isTouchDevice() ? EMAIL_TAB_IDS : DESKTOP_TAB_IDS).filter(- (id) =>- id !== 'reminders' ||- reminders().enabled ||- (reminders().loading && state.tab === 'reminders')- ),- activeId: () =>- !isTouchDevice() && state.tab === 'noise' ? 'important' : state.tab,+ ids: tabIds,+ // Desktop groups Signal and Noise under Inbox, so Tab toggles between+ // them instead of walking the sidebar.+ sequentialIds: () => (isTouchDevice() ? tabIds() : INBOX_TAB_IDS),+ activeId: () => state.tab,setActiveId: setTab,shouldHandleSequentialKeyEvent: (event) =>!(diff --git a/docs/agent-guide/email.md b/docs/agent-guide/email.mdindex f76a228104..a0458e4966 100644--- a/docs/agent-guide/email.md+++ b/docs/agent-guide/email.md@@ -37,10 +37,13 @@ Chat sidebar tabs. Selecting Inboxfrom another mailbox opens Signal; selecting it while in Noise keeps Noise.The desktop sidebar continues with `Favorites`, `Drafts`, `Sent`, `Scheduled`,and `Reminders` (when reminders are enabled), followed by a **Library** section containing `All mail`,-`Archived`, and `Shared`, then **Tags**. Sidebar number and sequential shortcuts-follow that order. Calendar mail remains available through the calendar filter-and existing Calendar route. Mobile keeps its original tabs and order, including-separate Signal, Noise, and Calendar tabs.+`Archived`, and `Shared`, then **Tags**. Sidebar number shortcuts follow that+order; `Tab` and `Shift+Tab` toggle between Signal and Noise (from another+mailbox, `Tab` opens Signal and `Shift+Tab` Noise). While the email list itself+has focus, `Tab` moves browser focus instead; use `g i` or `g o`. Calendar+mail remains available through the calendar filter and existing Calendar route.+Mobile keeps its original tabs and order, including separate Signal, Noise, and+Calendar tabs.Compose via the `Email` button (or `Create` → `Email E`). On a fresh local user itshows `Connect your email`; Gmail/Google Workspace and enabled Outlook connectionsuse provider consent. Most functionality needs a connected account. Search is `Ctrl+F` or `/` within the surface.