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.

feat(email): read threads in a pane beside the list (#8237)

teoae93d8d39525
diff --git a/apps/web/src/components/view-shell/ViewShell.tsx b/apps/web/src/components/view-shell/ViewShell.tsx
index bc5e44b07d..18b56441d6 100644
--- a/apps/web/src/components/view-shell/ViewShell.tsx
+++ b/apps/web/src/components/view-shell/ViewShell.tsx
@@ -617,8 +617,18 @@ export function ViewNavigationControls() {
);
}
-function Main(props: JSX.HTMLAttributes<HTMLElement>) {
- const [local, rest] = splitProps(props, ['children', 'class', 'ref']);
+type ViewShellMainProps = JSX.HTMLAttributes<HTMLElement> & {
+ /** Called with the solved width after a drag beside an inline detail. */
+ onWidthChangeEnd?: (width: number) => void;
+};
+
+function Main(props: ViewShellMainProps) {
+ const [local, rest] = splitProps(props, [
+ 'children',
+ 'class',
+ 'ref',
+ 'onWidthChangeEnd',
+ ]);
const ws = useViewShellInternal();
const layout = ws.main.layout;
const target = () => {
@@ -636,6 +646,7 @@ function Main(props: JSX.HTMLAttributes<HTMLElement>) {
minSize={layout().min}
maxSize={ws.detail.placement() === 'inline' ? layout().max : undefined}
target={target()}
+ onSizeChangeEnd={local.onWidthChangeEnd}
>
<main
{...rest}
diff --git a/apps/web/src/features/email-compose/primitives/reply-composer-focus.test.ts b/apps/web/src/features/email-compose/primitives/reply-composer-focus.test.ts
index a974699305..882645c87b 100644
--- a/apps/web/src/features/email-compose/primitives/reply-composer-focus.test.ts
+++ b/apps/web/src/features/email-compose/primitives/reply-composer-focus.test.ts
@@ -1,6 +1,9 @@
import { createRoot } from 'solid-js';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import { createReplyComposerFocus } from './reply-composer-focus';
+import {
+ createReplyComposerFocus,
+ takesFocusOnMount,
+} from './reply-composer-focus';
const disposers: (() => void)[] = [];
beforeEach(() => {
@@ -89,3 +92,25 @@ describe('reply focus lifetime', () => {
expect(document.activeElement).toBe(state.editorInput);
});
});
+
+describe('takesFocusOnMount', () => {
+ const mount = {
+ savedReply: true,
+ requested: false,
+ restoredSend: false,
+ desktop: true,
+ };
+
+ it('leaves a saved reply that reappears with its thread unfocused on desktop', () => {
+ expect(takesFocusOnMount(mount)).toBe(false);
+ });
+
+ it.each([
+ ['a new reply', { savedReply: false }],
+ ['a requested reply', { requested: true }],
+ ['an undone send', { restoredSend: true }],
+ ['a touch drawer', { desktop: false }],
+ ])('focuses %s', (_case, change) => {
+ expect(takesFocusOnMount({ ...mount, ...change })).toBe(true);
+ });
+});
diff --git a/apps/web/src/features/email-compose/primitives/reply-composer-focus.ts b/apps/web/src/features/email-compose/primitives/reply-composer-focus.ts
index fddc1e9cff..68056246df 100644
--- a/apps/web/src/features/email-compose/primitives/reply-composer-focus.ts
+++ b/apps/web/src/features/email-compose/primitives/reply-composer-focus.ts
@@ -1,6 +1,27 @@
import { makeEventListener } from '@solid-primitives/event-listener';
import { type Accessor, onCleanup, onMount } from 'solid-js';
+/**
+ * Whether a reply composer takes the keyboard when it mounts. A saved reply
+ * that reappears with its thread (opening it, stepping to it with j/k, the
+ * reading pane following the list cursor) waits on desktop until it is
+ * clicked or replied to: taking the keyboard would type the next j into it.
+ */
+export function takesFocusOnMount(mount: {
+ /** Mounted from a saved reply draft. */
+ savedReply: boolean;
+ /** A reply key, button or hand-off asked for this reply. */
+ requested: boolean;
+ /** Restores a send the user just undid. */
+ restoredSend: boolean;
+ /** Touch replies open in a drawer the user just asked for. */
+ desktop: boolean;
+}): boolean {
+ return (
+ !mount.savedReply || mount.requested || mount.restoredSend || !mount.desktop
+ );
+}
+
/** Keeps forward recipients focused through Lexical's deferred selection work. */
export function createReplyComposerFocus(options: {
editor: Accessor<{ focus(): void } | undefined>;
diff --git a/apps/web/src/features/email-compose/primitives/reply-composer.ts b/apps/web/src/features/email-compose/primitives/reply-composer.ts
index 80053d414b..703807e4af 100644
--- a/apps/web/src/features/email-compose/primitives/reply-composer.ts
+++ b/apps/web/src/features/email-compose/primitives/reply-composer.ts
@@ -65,7 +65,10 @@ import {
prepareMacroBody,
TOGGLE_APPEND_EMAIL_THREAD_COMMAND,
} from './prepare-email-body';
-import { createReplyComposerFocus } from './reply-composer-focus';
+import {
+ createReplyComposerFocus,
+ takesFocusOnMount,
+} from './reply-composer-focus';
import { createReplyRecipientFields } from './reply-recipient-fields';
import {
refuseSend,
@@ -247,6 +250,12 @@ export function createReplyComposer(
// A pending undo-send restore that belongs to this thread (inline reply
// remount case). It carries a just-undone send. Consumed below.
const restoredSnapshot = replyUndo.takePending(undoKey);
+ let mountFocus = takesFocusOnMount({
+ savedReply: draftSeed !== undefined && replyTarget !== undefined,
+ requested: untrack(() => ctx.replyRequest.replyType()) !== undefined,
+ restoredSend: restoredSnapshot !== undefined,
+ desktop: untrack(props.focusAfterReplyRequest),
+ });
// Switching inboxes can move a draft out of the displayed thread. Keep its
// persisted identity together for subsequent saves, discard, schedule and undo.
@@ -445,11 +454,14 @@ export function createReplyComposer(
createEffect(() => {
const rt = form.replyType();
if (!editorConnected()) return;
+ // Later reply-type changes are the user's, and always take focus.
+ const takeFocus = mountFocus;
+ mountFocus = true;
untrack(() => {
setComposerExpanded(false);
if (rt === 'forward') {
setQuoteCollapsed(true);
- focus.forward();
+ if (takeFocus) focus.forward();
const message = replyTarget;
const currentEditor = editor();
if (message && currentEditor && form.replyAppended()) {
@@ -469,7 +481,7 @@ export function createReplyComposer(
);
onCleanup(() => clearTimeout(timer));
}
- } else {
+ } else if (takeFocus) {
focus.reply();
}
});
diff --git a/apps/web/src/features/email-view/components/EmailControls.tsx b/apps/web/src/features/email-view/components/EmailControls.tsx
index 555782bc03..1cda5aa1bb 100644
--- a/apps/web/src/features/email-view/components/EmailControls.tsx
+++ b/apps/web/src/features/email-view/components/EmailControls.tsx
@@ -1,5 +1,10 @@
import { ListFilterDropdown } from '@app/components/view-shell';
+import { TOKENS } from '@core/hotkey/tokens';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import ColumnsIcon from '@phosphor/columns.svg';
+import { Button } from '@ui';
import { Show } from 'solid-js';
+import { useEmailView } from '../email-view-context';
import { useEmailFilters } from '../filters/use-email-filters';
export type EmailControlsProps = {
@@ -10,9 +15,23 @@ export type EmailControlsProps = {
export function EmailControls(props: EmailControlsProps) {
const filters = useEmailFilters();
+ const { readingPane, setReadingPane } = useEmailView();
return (
<div class="flex min-w-0 shrink-0 items-center justify-end gap-2 @max-[720px]/view-shell:gap-1">
+ <Show when={!isTouchDevice()}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ label={readingPane() ? 'Hide reading pane' : 'Show reading pane'}
+ hotkey={TOKENS.email.toggleReadingPane}
+ aria-pressed={readingPane()}
+ class={readingPane() ? 'text-ink' : 'text-ink-muted'}
+ onClick={() => setReadingPane(!readingPane())}
+ >
+ <ColumnsIcon class="size-4" />
+ </Button>
+ </Show>
<div class="relative shrink-0">
<ListFilterDropdown
label="Filter email"
diff --git a/apps/web/src/features/email-view/components/EmailDetailView.tsx b/apps/web/src/features/email-view/components/EmailDetailView.tsx
index 23bb72c62d..fae1b74383 100644
--- a/apps/web/src/features/email-view/components/EmailDetailView.tsx
+++ b/apps/web/src/features/email-view/components/EmailDetailView.tsx
@@ -38,10 +38,11 @@ import { buildEntityData } from '@entity';
import { useThreadQuery } from '@queries/email/thread';
import { representativeThreadMessage } from '@queries/email/thread-subject';
import { ButtonGroup } from '@ui';
-import { createMemo, createSignal, Show } from 'solid-js';
+import { createEffect, createMemo, createSignal, Show } from 'solid-js';
import { Portal } from 'solid-js/web';
import { emailDetailSearch } from '../email-route';
import { useEmailView } from '../email-view-context';
+import { useEmailReaderPane } from '../reader-pane';
import type { EmailThreadTarget } from '../types';
import { useEmailDetailListNavigation } from '../use-email-detail-list-navigation';
@@ -120,6 +121,10 @@ export function EmailDetailView(props: {
}) {
const { closeThread, selectedThread } = useEmailView();
const panel = useSplitPanelOrThrow();
+ // In the reading pane the thread keeps its keys in the reader's scope, and
+ // Escape hands the keyboard back to the list instead of closing it.
+ const pane = useEmailReaderPane();
+ const keyScope = pane?.hotkeyScope ?? panel.splitHotkeyScope;
const notificationSource = useGlobalNotificationSource();
const canAutofocus = useCanAutofocusSplitContent();
const [controlsMount, setControlsMount] = createSignal<HTMLDivElement>();
@@ -168,7 +173,7 @@ export function EmailDetailView(props: {
});
useBlockEntityCommands({
id: props.thread.id,
- scopeId: panel.splitHotkeyScope,
+ scopeId: keyScope,
resolveEntity: commandEntity,
onDeleted: closeThread,
onEmailReminderSaved: async () => {
@@ -182,8 +187,13 @@ export function EmailDetailView(props: {
element: () => container ?? null,
enabled: () => canAutofocus && panel.isPanelActive() && !isTouchDevice(),
});
+ createEffect(() => {
+ if (!pane || pane.focusRequest() !== props.thread.id) return;
+ pane.clearFocusRequest();
+ focusContainer();
+ });
const listNavigation = useEmailDetailListNavigation(threadId);
- const hotkeyScope = () => panel.splitHotkeyScope;
+ const hotkeyScope = () => keyScope;
const host: EmailThreadHost = {
returnToList: closeThread,
listNavigation,
@@ -208,7 +218,7 @@ export function EmailDetailView(props: {
// back to the list this thread was opened from.
keyDownHandler: () => {
if (handlers.cancel()) return true;
- closeThread();
+ (pane?.focusList ?? closeThread)();
return true;
},
hotkeyToken: TOKENS.email.cancelReply,
@@ -218,7 +228,7 @@ export function EmailDetailView(props: {
};
const breadcrumbValue = () => `email-thread:${props.thread.id}`;
useListNavigationHotkeys({
- scopeId: panel.splitHotkeyScope,
+ scopeId: keyScope,
enabled: () =>
panel.isPanelActive() && selectedThread()?.id === props.thread.id,
navigation: listNavigation,
@@ -248,7 +258,7 @@ export function EmailDetailView(props: {
onClick={openShare}
id={props.thread.id}
blockType="email"
- hotkeyScope={panel.splitHotkeyScope}
+ hotkeyScope={keyScope}
/>
</Show>
<SidePanel.Toggle />
diff --git a/apps/web/src/features/email-view/components/EmailHeader.tsx b/apps/web/src/features/email-view/components/EmailHeader.tsx
index 312cbc78e2..0e22cb65b1 100644
--- a/apps/web/src/features/email-view/components/EmailHeader.tsx
+++ b/apps/web/src/features/email-view/components/EmailHeader.tsx
@@ -48,11 +48,24 @@ export function EmailViewBreadcrumbItem() {
);
}
-export function EmailTopBar() {
+export function EmailTopBar(props: {
+ /** Beside a reading pane the reader shows the trail; the list shows its tab. */
+ tabOnly?: boolean;
+}) {
+ const { state } = useEmailView();
+ const tabTitle = () =>
+ EMAIL_TABS.find((tab) => tab.id === state.tab)?.label ?? 'Email';
return (
<ViewShell.TopBar>
<div class="flex min-w-0 flex-1 items-baseline gap-2">
- <ViewBreadcrumbs.Outlet aria-label="Email location" />
+ <Show
+ when={props.tabOnly}
+ fallback={<ViewBreadcrumbs.Outlet aria-label="Email location" />}
+ >
+ <h2 class="truncate px-1 text-sm font-medium text-ink">
+ {tabTitle()}
+ </h2>
+ </Show>
<EmailInboxFilter class="@max-[720px]/view-shell:hidden" />
</div>
</ViewShell.TopBar>
diff --git a/apps/web/src/features/email-view/components/EmailList.tsx b/apps/web/src/features/email-view/components/EmailList.tsx
index 66fa03b655..24f29709e9 100644
--- a/apps/web/src/features/email-view/components/EmailList.tsx
+++ b/apps/web/src/features/email-view/components/EmailList.tsx
@@ -20,6 +20,7 @@ import { SwipableRowProvider } from '@components/app/mobile/SwipableRow';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import { createSplitAutofocus } from '@components/app/split-layout/utils/createSplitAutofocus';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import { debounce } from '@core/util/debounce';
import {
type EntityData,
EntitySelectionToolbar,
@@ -35,10 +36,13 @@ import { createElementSize } from '@solid-primitives/resize-observer';
import { Button, cn } from '@ui';
import { tourTarget } from '@ui/components/Tour';
import {
+ createComputed,
createEffect,
createMemo,
createSignal,
Match,
+ on,
+ onCleanup,
type Setter,
Show,
Suspense,
@@ -61,6 +65,7 @@ import {
} from '../persistence';
import { createEmailRowActionState } from '../primitives/row-action-state';
import type { EmailDataSourceItem } from '../queries/use-email-query';
+import type { EmailListPane } from '../reader-pane';
import { EMAIL_TOUR } from '../tour';
import { useEmailListHotkeys } from '../use-email-list-hotkeys';
import { EmailDateGroupHeader } from './EmailDateGroupHeader';
@@ -75,6 +80,8 @@ type EmailActionRow = {
export type EmailListProps = {
/** The focusable list root, for callers that hand keyboard focus back. */
ref?: (element: HTMLDivElement) => void;
+ /** Present while threads open in a reading pane beside the list. */
+ pane?: EmailListPane;
};
export function EmailList(props: EmailListProps) {
@@ -84,6 +91,7 @@ export function EmailList(props: EmailListProps) {
list,
registerListActivationHandler,
openThread,
+ selectedThread,
filterByTag,
} = useEmailView();
const panel = useSplitPanelOrThrow();
@@ -132,8 +140,12 @@ export function EmailList(props: EmailListProps) {
{ id: sourceRow.entity.id, fallbackName: sourceRow.entity.name },
{ event: metadata?.event }
)
- )
+ ) {
+ // Opening a row in the pane hands it the keyboard, so r, e and the
+ // message arrows act on the thread just opened.
+ props.pane?.focusReader(sourceRow.entity.id);
return;
+ }
openEntity(sourceRow.entity, {
event: metadata?.event,
@@ -155,8 +167,9 @@ export function EmailList(props: EmailListProps) {
const topSpacerSize = createElementSize(topSpacer);
const [emptyViewport, setEmptyViewport] = createSignal<HTMLDivElement>();
const [grid, setGrid] = createSignal<HTMLDivElement>();
- // Coming back from a thread remounts the list with focus on the page; the
- // list takes it so its keys and screen-reader cursor work.
+ // Coming back from a thread, or toggling the reading pane, remounts the
+ // list with focus on the page; the list takes it so its keys and
+ // screen-reader cursor work.
createSplitAutofocus({
element: () => grid() ?? null,
enabled: () => panel.isPanelActive() && !isTouchDevice(),
@@ -220,6 +233,29 @@ export function EmailList(props: EmailListProps) {
return row?.kind === 'entity' ? row.entity : undefined;
};
+ // With a reading pane, the open thread follows the keyboard cursor. Held
+ // keys settle first; following replaces history rather than adding to it.
+ const followInPane = debounce((entity: EntityData | undefined) => {
+ if (!props.pane || entity?.type !== 'email') return;
+ props.pane.focusReader(undefined);
+ openThread({ id: entity.id, fallbackName: entity.name }, { replace: true });
+ }, 60);
+ onCleanup(() => followInPane.clear());
+ // The row the cursor was on before its latest move, read when an action
+ // moves the cursor: the pane follows only if it showed that row.
+ let previousCursorId: string | undefined;
+ createComputed(
+ on(
+ () => focusedEntity()?.id,
+ (_id, previous) => {
+ previousCursorId = previous;
+ }
+ )
+ );
+ // While the reader has the keyboard the list's keys stand down.
+ const listHasKeyboard = () =>
+ panel.isPanelActive() && !(props.pane?.readerHasKeyboard() ?? false);
+
const [collapseEntity, setCollapseEntity] =
createSignal<(entityId: string) => Promise<void>>();
@@ -237,6 +273,11 @@ export function EmailList(props: EmailListProps) {
onFocus: (target) => {
if (target) {
virtualizer()?.scrollToIndex(target.index, { align: 'nearest' });
+ // Mark done moved past the open thread: the pane follows. An action
+ // on another row (under the pointer) leaves the pane where it is.
+ if (previousCursorId === selectedThread()?.id) {
+ followInPane(target.entity);
+ }
}
grid()?.focus();
@@ -247,9 +288,11 @@ export function EmailList(props: EmailListProps) {
controller: list,
scopeId: panel.splitHotkeyScope,
scrollHandle: virtualizer,
- enabled: panel.isPanelActive,
+ enabled: listHasKeyboard,
navigation: {
onNavigate: (event) => {
+ const row = event.result?.item;
+ if (row?.kind === 'entity') followInPane(row.entity);
if (event.kind !== 'move' || event.direction !== 1) return;
if (source.isLoadingMore() || source.error() || !source.hasMore())
return;
@@ -282,12 +325,12 @@ export function EmailList(props: EmailListProps) {
restoreFocus: () => grid()?.focus(),
viewContext: entityActionViewContext,
splitHandle: panel.handle,
- condition: panel.isPanelActive,
+ condition: listHasKeyboard,
});
useEmailListHotkeys({
scopeId: panel.splitHotkeyScope,
- enabled: panel.isPanelActive,
+ enabled: listHasKeyboard,
selectedEntities,
clearSelection: listInteractions.selection.clear,
});
@@ -464,7 +507,7 @@ export function EmailList(props: EmailListProps) {
onRefresh={pullRefresh}
/>
- <ListLayoutProvider ref={grid}>
+ <ListLayoutProvider ref={grid} narrowLayout="inbox">
<SwipableRowProvider
container={viewport}
setCollapseEntity={setCollapseEntity}
@@ -669,6 +712,11 @@ export function EmailList(props: EmailListProps) {
!isTouchDevice() &&
list.focus.key() === entityRow().id
}
+ current={
+ props.pane !== undefined &&
+ selectedThread()?.id ===
+ entityRow().entity.id
+ }
onMouseMove={() =>
list.focus.set(entityRow().id, {
reason: 'hover',
diff --git a/apps/web/src/features/email-view/components/EmailReader.test.tsx b/apps/web/src/features/email-view/components/EmailReader.test.tsx
new file mode 100644
index 0000000000..9d359557eb
--- /dev/null
+++ b/apps/web/src/features/email-view/components/EmailReader.test.tsx
@@ -0,0 +1,59 @@
+import { cleanup, render } from '@solidjs/testing-library';
+import {
+ type Accessor,
+ type Component,
+ createSignal,
+ lazy,
+ Suspense,
+} from 'solid-js';
+import { afterEach, expect, it, vi } from 'vitest';
+import { EmailReader } from './EmailReader';
+
+// The outlet renders whichever thread view the test routes to.
+const outlet = vi.hoisted(() => ({
+ view: (() => undefined) as Accessor<Component | undefined>,
+}));
+
+vi.mock('@app/lib/split-router', async () => {
+ const { Dynamic } = await import('solid-js/web');
+ return {
+ SplitRouter: {
+ Outlet: (props: { fallback: Component }) => (
+ <Dynamic component={outlet.view() ?? props.fallback} />
+ ),
+ },
+ };
+});
+
+afterEach(cleanup);
+
+function renderBesideList() {
+ const [view, setView] = createSignal<Component>();
+ outlet.view = view;
+ const screen = render(() => (
+ <Suspense fallback={<p>Loading Email</p>}>
+ <div role="grid" aria-label="Email" tabIndex={0} />
+ <EmailReader focusList={() => {}} setListPane={() => {}} />
+ </Suspense>
+ ));
+ return { screen, setView };
+}
+
+it('shows the empty state until a thread opens', () => {
+ const { screen } = renderBesideList();
+
+ expect(screen.getByText('No conversation selected')).toBeTruthy();
+});
+
+it('keeps the list mounted and focused while the next thread loads', () => {
+ const { screen, setView } = renderBesideList();
+ setView(() => () => <p>First thread</p>);
+ const list = screen.getByRole('grid');
+ list.focus();
+
+ setView(() => lazy(() => new Promise<{ default: Component }>(() => {})));
+
+ expect(screen.queryByText('Loading Email')).toBeNull();
+ expect(list.isConnected).toBe(true);
+ expect(document.activeElement).toBe(list);
+});
diff --git a/apps/web/src/features/email-view/components/EmailReader.tsx b/apps/web/src/features/email-view/components/EmailReader.tsx
new file mode 100644
index 0000000000..0f9326caf0
--- /dev/null
+++ b/apps/web/src/features/email-view/components/EmailReader.tsx
@@ -0,0 +1,57 @@
+import { SplitRouter } from '@app/lib/split-router';
+import { useHotkeyDOMScope } from '@core/hotkey/hotkeys';
+import { isScopeInActiveBranch } from '@core/hotkey/utils';
+import EnvelopeOpenIcon from '@phosphor/envelope-simple-open.svg';
+import { createSignal, onCleanup, Suspense } from 'solid-js';
+import { type EmailListPane, EmailReaderPaneContext } from '../reader-pane';
+
+function EmailReaderEmpty() {
+ return (
+ <div class="flex size-full min-h-0 min-w-0 flex-col items-center justify-center gap-1 px-6 text-center">
+ <EnvelopeOpenIcon class="mb-2 size-6 text-ink-extra-muted" />
+ <p class="text-sm text-ink-muted">No conversation selected</p>
+ <p class="text-xs text-ink-extra-muted">
+ Pick one from the list, or move with j and k
+ </p>
+ </div>
+ );
+}
+
+/** The reading pane: the thread route, in its own hotkey scope. */
+export function EmailReader(props: {
+ focusList: () => void;
+ setListPane: (pane: EmailListPane | undefined) => void;
+}) {
+ const [attachHotkeys, hotkeyScope] = useHotkeyDOMScope('email-reader');
+ const [focusRequest, setFocusRequest] = createSignal<string>();
+ props.setListPane({
+ focusReader: (threadId) => setFocusRequest(threadId),
+ readerHasKeyboard: () => isScopeInActiveBranch(hotkeyScope),
+ });
+ onCleanup(() => props.setListPane(undefined));
+ return (
+ <div
+ ref={attachHotkeys}
+ role="region"
+ aria-label="Reading pane"
+ class="size-full min-h-0 min-w-0"
+ >
+ <EmailReaderPaneContext.Provider
+ value={{
+ hotkeyScope,
+ focusList: props.focusList,
+ focusRequest,
+ requestFocus: setFocusRequest,
+ clearFocusRequest: () => setFocusRequest(undefined),
+ }}
+ >
+ {/* A thread that is still loading suspends here, not the Email view,
+ so the list beside it stays mounted and keeps the keyboard while
+ the pane follows its cursor. */}
+ <Suspense>
+ <SplitRouter.Outlet fallback={EmailReaderEmpty} />
+ </Suspense>
+ </EmailReaderPaneContext.Provider>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/email-view/email-view-context.tsx b/apps/web/src/features/email-view/email-view-context.tsx
index c8c7550116..3e37a20dc4 100644
--- a/apps/web/src/features/email-view/email-view-context.tsx
+++ b/apps/web/src/features/email-view/email-view-context.tsx
@@ -15,6 +15,7 @@ import {
useNavigate,
useRouteParams,
} from '@app/lib/split-router';
+import { usePreference } from '@app/preferences/use-preference';
import { emailSplitRoute, emailThreadRoute } from '@app/routes/routes';
import { createPreviewSelectionGuard } from '@components/app/createPreviewSelectionGuard';
import {
@@ -108,11 +109,17 @@ export type EmailViewContext = {
/** Returns false when inline detail is unavailable so the caller opens a split instead. */
openThread: (
thread: EmailThreadTarget,
- options?: EntityDetailNavigationOptions
+ options?: EntityDetailNavigationOptions & {
+ /** Replace the history entry, for opens that follow the list cursor. */
+ replace?: boolean;
+ }
) => boolean;
closeThread: () => void;
isSidebarSectionOpen: (id: string) => boolean;
setSidebarSectionOpen: (id: string, open: boolean) => void;
+ /** Open threads beside the list instead of in its place (desktop). */
+ readingPane: Accessor<boolean>;
+ setReadingPane: (enabled: boolean) => void;
};
export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<
@@ -256,7 +263,7 @@ export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<
);
const openThread = (
thread: EmailThreadTarget,
- options?: EntityDetailNavigationOptions
+ options?: EntityDetailNavigationOptions & { replace?: boolean }
) => {
if (!opensInline(options)) return false;
const selection = { type: 'email' as const, id: thread.id };
@@ -266,6 +273,7 @@ export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<
navigate(
{ route: emailThreadRoute, params: { threadId: thread.id } },
{
+ replace: options?.replace,
search: {
[emailDetailSearch.namespace]: {},
[emailTabSearch.namespace]: emailTabSearchCodec.serialize({
@@ -400,6 +408,11 @@ export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<
);
};
+ const [readingPane, setReadingPane] = usePreference(
+ 'macro:pref:email:reading-pane',
+ { default: false }
+ );
+
const isSidebarSectionOpen = (id: string) =>
!state.collapsedSidebarSectionIds.includes(id);
@@ -425,5 +438,7 @@ export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<
closeThread,
isSidebarSectionOpen,
setSidebarSectionOpen,
+ readingPane,
+ setReadingPane,
};
});
diff --git a/apps/web/src/features/email-view/email-view.tsx b/apps/web/src/features/email-view/email-view.tsx
index c5d9c4f260..cd4810df11 100644
--- a/apps/web/src/features/email-view/email-view.tsx
+++ b/apps/web/src/features/email-view/email-view.tsx
@@ -1,7 +1,12 @@
-import { ViewBreadcrumbs, ViewShell } from '@app/components/view-shell';
+import {
+ useViewShell,
+ ViewBreadcrumbs,
+ ViewShell,
+} from '@app/components/view-shell';
import { ViewTour } from '@app/features/tours/ViewTour';
import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { SplitRouter } from '@app/lib/split-router';
+import { usePreference } from '@app/preferences/use-preference';
import { type PillTabItem, PillTabs } from '@components/app/mobile/PillTabs';
import { SplitHeaderLeft } from '@components/app/split-layout/components/SplitHeader';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
@@ -13,6 +18,7 @@ import { ListEntityMetadataQueryProvider } from '@entity';
import SpinnerIcon from '@phosphor/spinner.svg';
import {
createSignal,
+ type JSX,
onMount,
type ParentProps,
Show,
@@ -25,11 +31,14 @@ import {
EmailViewBreadcrumbItem,
} from './components/EmailHeader';
import { EmailList } from './components/EmailList';
+import { EmailReader } from './components/EmailReader';
import { EmailSidebar } from './components/EmailSidebar';
import { EMAIL_TABS } from './constants';
import { EmailViewProvider, useEmailView } from './email-view-context';
+import type { EmailListPane } from './reader-pane';
import { emailTour } from './tour';
import type { EmailTab, EmailViewStateOptions } from './types';
+import { useReadingPaneHotkey } from './use-reading-pane-hotkey';
export type EmailViewProps = {
/** Explicit navigation state. When present, it wins over entry restoration. */
@@ -64,33 +73,98 @@ function EmailListFallback() {
);
}
-function EmailDesktopLayout(
- props: ParentProps<{ onSearchEscape: () => void }>
-) {
- const list = () => (
+function EmailPanes(props: {
+ list: JSX.Element;
+ focusList: () => void;
+ setListPane: (pane: EmailListPane | undefined) => void;
+ onListWidthChange: (width: number) => void;
+}) {
+ const shell = useViewShell();
+ const listColumn = (beside?: 'reader') => (
<>
- <EmailTopBar />
+ <EmailTopBar tabOnly={beside === 'reader'} />
<ViewShell.Header>
- <EmailHeader onSearchEscape={props.onSearchEscape} />
+ <EmailHeader onSearchEscape={props.focusList} />
</ViewShell.Header>
<ViewTour tour={emailTour} />
- <ViewShell.Content>{props.children}</ViewShell.Content>
+ <ViewShell.Content>{props.list}</ViewShell.Content>
</>
);
+ // Without room for both, the reading pane folds away and a thread
+ // replaces the list, as it does with the pane turned off.
+ return (
+ <Show
+ when={shell.detail.placement() === 'inline'}
+ fallback={
+ <ViewShell.Main>
+ <SplitRouter.Outlet fallback={() => listColumn()} />
+ </ViewShell.Main>
+ }
+ >
+ <ViewShell.Main onWidthChangeEnd={props.onListWidthChange}>
+ {listColumn('reader')}
+ </ViewShell.Main>
+ <ViewShell.Detail class="border-l border-edge-muted">
+ <EmailReader
+ focusList={props.focusList}
+ setListPane={props.setListPane}
+ />
+ </ViewShell.Detail>
+ </Show>
+ );
+}
+
+/** The list column's width beside the reading pane, in pixels. */
+const LIST_WIDTH = { default: 440, min: 340, max: 720 };
+
+function EmailDesktopLayout(props: {
+ list: JSX.Element;
+ focusList: () => void;
+ setListPane: (pane: EmailListPane | undefined) => void;
+}) {
+ const { readingPane } = useEmailView();
+ const [storedListWidth, setListWidth] = usePreference(
+ 'macro:pref:email:reading-pane-list-width',
+ { default: LIST_WIDTH.default }
+ );
+ // A stored width from an older layout still fits the current bounds.
+ const listWidth = () =>
+ Math.min(LIST_WIDTH.max, Math.max(LIST_WIDTH.min, storedListWidth()));
+
return (
<ViewShell.Root
asidePreferenceKey="email"
resizable
aside={{ preserveDuringResize: false }}
- main={{ preferredWidth: 640 }}
+ main={
+ readingPane()
+ ? {
+ preferredWidth: 640,
+ width: listWidth(),
+ min: LIST_WIDTH.min,
+ max: LIST_WIDTH.max,
+ }
+ : { preferredWidth: 640 }
+ }
+ detail={{
+ width: 640,
+ initialWidth: 'auto',
+ min: 440,
+ max: 4000,
+ whenNarrow: 'hide',
+ }}
+ detailOpen={readingPane()}
>
<ViewShell.Aside>
<EmailSidebar />
</ViewShell.Aside>
- <ViewShell.Main>
- <SplitRouter.Outlet fallback={list} />
- </ViewShell.Main>
+ <EmailPanes
+ list={props.list}
+ focusList={props.focusList}
+ setListPane={props.setListPane}
+ onListWidthChange={setListWidth}
+ />
</ViewShell.Root>
);
}
@@ -139,13 +213,23 @@ function EmailMobileLayout(props: ParentProps) {
function EmailViewRoot() {
const panel = useSplitPanelOrThrow();
+ const { readingPane, setReadingPane } = useEmailView();
const [listElement, setListElement] = createSignal<HTMLDivElement>();
+ const [listPane, setListPane] = createSignal<EmailListPane>();
+ const focusList = () => listElement()?.focus();
onMount(() => panel.handle.setDisplayName('Email'));
+ useReadingPaneHotkey({
+ scopeId: panel.splitHotkeyScope,
+ enabled: () => panel.isPanelActive() && !isTouchDevice(),
+ readingPane,
+ setReadingPane,
+ });
+
const list = () => (
<Suspense fallback={<EmailListFallback />}>
- <EmailList ref={setListElement} />
+ <EmailList ref={setListElement} pane={listPane()} />
</Suspense>
);
@@ -156,9 +240,11 @@ function EmailViewRoot() {
<Show
when={isTouchDevice()}
fallback={
- <EmailDesktopLayout onSearchEscape={() => listElement()?.focus()}>
- {list()}
- </EmailDesktopLayout>
+ <EmailDesktopLayout
+ list={list()}
+ focusList={focusList}
+ setListPane={setListPane}
+ />
}
>
<EmailMobileLayout>{list()}</EmailMobileLayout>
diff --git a/apps/web/src/features/email-view/reader-pane.ts b/apps/web/src/features/email-view/reader-pane.ts
new file mode 100644
index 0000000000..994c4f3af3
--- /dev/null
+++ b/apps/web/src/features/email-view/reader-pane.ts
@@ -0,0 +1,35 @@
+import { type Accessor, createContext, useContext } from 'solid-js';
+
+/**
+ * Present while threads open in a reading pane beside the list instead of
+ * replacing it. The list keeps its own keys; the reader's live in a child
+ * scope so the two never replace each other's registrations.
+ */
+export type EmailReaderPane = {
+ /** The reader's hotkey scope, a child of the split's. */
+ hotkeyScope: string;
+ /** Hands the keyboard back to the list without closing the thread. */
+ focusList: () => void;
+ /** The thread that should take focus once it is on screen. */
+ focusRequest: Accessor<string | undefined>;
+ requestFocus: (threadId: string) => void;
+ clearFocusRequest: () => void;
+};
+
+export const EmailReaderPaneContext = createContext<EmailReaderPane>();
+
+export const useEmailReaderPane = () => useContext(EmailReaderPaneContext);
+
+/** Hooks the list uses while threads open in the reading pane beside it. */
+export type EmailListPane = {
+ /**
+ * Moves the keyboard into the reader once this thread is on screen;
+ * `undefined` cancels a request the cursor has moved past.
+ */
+ focusReader: (threadId: string | undefined) => void;
+ /**
+ * The reader has the keyboard. The list's keys stand down so a key the
+ * reader does not use (Backspace, Cmd+A) never acts on the list.
+ */
+ readerHasKeyboard: () => boolean;
+};
diff --git a/apps/web/src/features/email-view/use-email-detail-list-navigation.test.ts b/apps/web/src/features/email-view/use-email-detail-list-navigation.test.ts
index ff3db9e7a8..795f72d8ba 100644
--- a/apps/web/src/features/email-view/use-email-detail-list-navigation.test.ts
+++ b/apps/web/src/features/email-view/use-email-detail-list-navigation.test.ts
@@ -1,6 +1,7 @@
import type { EmailEntity } from '@entity';
import { createRoot, createSignal } from 'solid-js';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { EmailReaderPaneContext } from './reader-pane';
import { useEmailDetailListNavigation } from './use-email-detail-list-navigation';
const mocks = vi.hoisted(() => ({
@@ -8,6 +9,7 @@ const mocks = vi.hoisted(() => ({
open: vi.fn(),
failure: vi.fn(),
loadMore: vi.fn(),
+ focus: vi.fn(),
}));
vi.mock('./email-view-context', () => ({ useEmailView: mocks.view }));
vi.mock('@core/component/Toast/Toast', () => ({
@@ -22,7 +24,11 @@ beforeEach(() => vi.resetAllMocks());
afterEach(() => {
for (const dispose of disposals.splice(0)) dispose();
});
-function setup(ids: string[], current = 'b') {
+function setup(
+ ids: string[],
+ current = 'b',
+ options: { inPane?: boolean } = {}
+) {
const [rows, setRows] = createSignal(ids);
const [threadId, setThreadId] = createSignal(current);
const [hasMore, setHasMore] = createSignal(false);
@@ -31,6 +37,7 @@ function setup(ids: string[], current = 'b') {
items: () =>
rows().map((id) => ({
kind: 'entity',
+ id: `row:${id}`,
entity: { type: 'email', id, name: id } as EmailEntity,
})),
hasMore,
@@ -38,10 +45,26 @@ function setup(ids: string[], current = 'b') {
error: () => undefined,
},
openThread: mocks.open,
+ list: { focus: { set: mocks.focus } },
});
const navigation = createRoot((dispose) => {
disposals.push(dispose);
- return useEmailDetailListNavigation(threadId);
+ if (!options.inPane) return useEmailDetailListNavigation(threadId);
+ let inPane!: ReturnType<typeof useEmailDetailListNavigation>;
+ EmailReaderPaneContext.Provider({
+ value: {
+ hotkeyScope: 'email-reader',
+ focusList: () => {},
+ focusRequest: () => undefined,
+ requestFocus: () => {},
+ clearFocusRequest: () => {},
+ },
+ get children() {
+ inPane = useEmailDetailListNavigation(threadId);
+ return null;
+ },
+ });
+ return inPane;
});
return { navigation, setRows, setHasMore, setThreadId };
}
@@ -100,3 +123,19 @@ describe('email reminder navigation', () => {
expect(mocks.open).toHaveBeenCalledWith({ id: 'c', fallbackName: 'c' });
});
});
+
+describe('thread navigation in the reading pane', () => {
+ it('moves the list cursor and replaces history with each step', async () => {
+ const { navigation } = setup(['a', 'b', 'c'], 'b', { inPane: true });
+ navigation.next();
+ await vi.waitFor(() =>
+ expect(mocks.open).toHaveBeenLastCalledWith(
+ { id: 'c', fallbackName: 'c' },
+ { replace: true }
+ )
+ );
+ expect(mocks.focus).toHaveBeenLastCalledWith('row:c', {
+ reason: 'programmatic',
+ });
+ });
+});
diff --git a/apps/web/src/features/email-view/use-email-detail-list-navigation.ts b/apps/web/src/features/email-view/use-email-detail-list-navigation.ts
index f14bf18fa8..3e29e4d944 100644
--- a/apps/web/src/features/email-view/use-email-detail-list-navigation.ts
+++ b/apps/web/src/features/email-view/use-email-detail-list-navigation.ts
@@ -8,12 +8,16 @@ import type { EntityData } from '@entity';
import { type Accessor, createMemo, onCleanup } from 'solid-js';
import { useEmailView } from './email-view-context';
import type { EmailDataSourceItem } from './queries/use-email-query';
+import { useEmailReaderPane } from './reader-pane';
/** Keeps thread triage inside the Email view's filtered navigation stack. */
export function useEmailDetailListNavigation(
threadId: Accessor<string>
): EmailThreadListNavigation {
- const { source, openThread } = useEmailView();
+ const { source, openThread, list } = useEmailView();
+ // Beside the list, the reader steps like the list cursor: the cursor moves
+ // with it and each step replaces history instead of adding an entry.
+ const inPane = useEmailReaderPane() !== undefined;
const emails = () =>
source
.items()
@@ -58,7 +62,16 @@ export function useEmailDetailListNavigation(
row.kind === 'load-more' ? source.loadMore : undefined,
open: (entity) => {
if (entity.type !== 'email') return;
- openThread({ id: entity.id, fallbackName: entity.name });
+ const thread = { id: entity.id, fallbackName: entity.name };
+ if (!inPane) {
+ openThread(thread);
+ return;
+ }
+ const row = source
+ .items()
+ .find((item) => item.kind === 'entity' && item.entity.id === entity.id);
+ if (row) list.focus.set(row.id, { reason: 'programmatic' });
+ openThread(thread, { replace: true });
},
onError: () => toast.failure('Unable to open the next or previous email'),
});
diff --git a/apps/web/src/features/email-view/use-reading-pane-hotkey.test.tsx b/apps/web/src/features/email-view/use-reading-pane-hotkey.test.tsx
new file mode 100644
index 0000000000..549addf24a
--- /dev/null
+++ b/apps/web/src/features/email-view/use-reading-pane-hotkey.test.tsx
@@ -0,0 +1,47 @@
+import {
+ attachGlobalDOMScope,
+ useHotKeyRoot,
+ useHotkeyDOMScope,
+} from '@core/hotkey/hotkeys';
+import { setActiveScope } from '@core/hotkey/state';
+import { cleanup, render } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, expect, it } from 'vitest';
+import { useReadingPaneHotkey } from './use-reading-pane-hotkey';
+
+afterEach(() => {
+ cleanup();
+ setActiveScope('global');
+});
+
+function press(key: string, init: KeyboardEventInit = {}) {
+ document.dispatchEvent(
+ new KeyboardEvent('keydown', { key, bubbles: true, ...init })
+ );
+ document.dispatchEvent(new KeyboardEvent('keyup', { key, bubbles: true }));
+}
+
+it('shows and hides the reading pane with Shift+V', () => {
+ const [readingPane, setReadingPane] = createSignal(false);
+ const view = render(() => {
+ useHotKeyRoot();
+ const [attachEmail, emailScope] = useHotkeyDOMScope('email-split');
+ useReadingPaneHotkey({
+ scopeId: emailScope,
+ enabled: () => true,
+ readingPane,
+ setReadingPane,
+ });
+ return (
+ <div ref={(element) => attachGlobalDOMScope(element)}>
+ <div ref={attachEmail} tabIndex={0} data-testid="email" />
+ </div>
+ );
+ });
+ view.getByTestId('email').focus();
+
+ press('V', { shiftKey: true });
+ expect(readingPane()).toBe(true);
+ press('V', { shiftKey: true });
+ expect(readingPane()).toBe(false);
+});
diff --git a/apps/web/src/features/email-view/use-reading-pane-hotkey.ts b/apps/web/src/features/email-view/use-reading-pane-hotkey.ts
new file mode 100644
index 0000000000..e8071f0cb0
--- /dev/null
+++ b/apps/web/src/features/email-view/use-reading-pane-hotkey.ts
@@ -0,0 +1,24 @@
+import { registerHotkey } from '@core/hotkey/hotkeys';
+import { TOKENS } from '@core/hotkey/tokens';
+import type { Accessor } from 'solid-js';
+
+/** Shift+V shows or hides the reading pane while Email is focused. */
+export function useReadingPaneHotkey(options: {
+ scopeId: string;
+ enabled: Accessor<boolean>;
+ readingPane: Accessor<boolean>;
+ setReadingPane: (enabled: boolean) => void;
+}) {
+ registerHotkey({
+ hotkey: 'shift+v',
+ hotkeyToken: TOKENS.email.toggleReadingPane,
+ scopeId: options.scopeId,
+ description: () =>
+ options.readingPane() ? 'Hide reading pane' : 'Show reading pane',
+ condition: options.enabled,
+ keyDownHandler: () => {
+ options.setReadingPane(!options.readingPane());
+ return true;
+ },
+ });
+}
diff --git a/apps/web/src/features/entity/composed/ListEntity.tsx b/apps/web/src/features/entity/composed/ListEntity.tsx
index b7cdae5cf0..71f395d10c 100644
--- a/apps/web/src/features/entity/composed/ListEntity.tsx
+++ b/apps/web/src/features/entity/composed/ListEntity.tsx
@@ -195,6 +195,8 @@ export function ListEntity(props: ListEntityProps) {
const usesCondensedNarrowLayout = () => !isWide() && isCondensedVariant();
const isSingleLineVariant = () =>
listLayout?.narrowLayout() === 'single-line';
+ const stacksNarrowEmail = () =>
+ isTouchDevice() || listLayout?.narrowLayout() === 'inbox';
const mobileStacks = createMemo(() => {
if (!isTouchDevice()) return [];
@@ -246,8 +248,11 @@ export function ListEntity(props: ListEntityProps) {
!props.highlighted && !props.checked && !isTouchDevice(),
'focus-within:bg-list-hover focus-within:[--avatar-group-separator:var(--color-list-hover)]':
!!rowActions() && !props.highlighted && !props.checked,
+ 'before:absolute before:inset-y-2 before:left-0 before:w-0.5 before:rounded-full before:bg-accent':
+ props.current,
}
)}
+ aria-current={props.current ? 'true' : undefined}
onMouseMove={props.onMouseMove}
>
<Switch>
@@ -279,10 +284,10 @@ export function ListEntity(props: ListEntityProps) {
</Match>
<Match
when={
- isTouchDevice() &&
- ((isChannelEntity(props.entity) && !isCondensedVariant()) ||
- isEmailEntity(props.entity) ||
- props.showUnrollNotifications)
+ (isTouchDevice() &&
+ ((isChannelEntity(props.entity) && !isCondensedVariant()) ||
+ props.showUnrollNotifications)) ||
+ (stacksNarrowEmail() && isEmailEntity(props.entity))
}
>
<MaybeEntityRow
diff --git a/apps/web/src/features/entity/composed/list-entity/shared.tsx b/apps/web/src/features/entity/composed/list-entity/shared.tsx
index abb4abfac2..70a62fc99a 100644
--- a/apps/web/src/features/entity/composed/list-entity/shared.tsx
+++ b/apps/web/src/features/entity/composed/list-entity/shared.tsx
@@ -31,6 +31,8 @@ export interface BaseListEntityProps<E extends EntityData = EntityData>
ref?: Ref<HTMLDivElement>;
checked?: boolean;
highlighted?: boolean;
+ /** The row open beside the list, marked while the cursor moves elsewhere. */
+ current?: boolean;
hovered?: boolean;
/** Caller-owned quick actions, revealed on pointer hover or keyboard focus. */
actions?: JSX.Element;
@@ -105,7 +107,16 @@ export interface LayoutProps {
showProject?: boolean;
}
-export type NarrowLayoutVariant = 'standard' | 'condensed' | 'single-line';
+/**
+ * How rows render once the list is too narrow for columns. `inbox` stacks
+ * email rows (sender, subject, snippet) as touch devices do, for lists that
+ * sit beside a reading pane.
+ */
+export type NarrowLayoutVariant =
+ | 'standard'
+ | 'condensed'
+ | 'single-line'
+ | 'inbox';
interface ListLayoutContextValue {
isWide: Accessor<boolean>;
diff --git a/apps/web/src/features/settings/Shortcuts.tsx b/apps/web/src/features/settings/Shortcuts.tsx
index e69ea81332..57808c57e5 100644
--- a/apps/web/src/features/settings/Shortcuts.tsx
+++ b/apps/web/src/features/settings/Shortcuts.tsx
@@ -999,6 +999,16 @@ const shortcutSections: ShortcutSection[] = [
},
],
},
+ {
+ title: 'Email',
+ items: [
+ {
+ keys: ['shift+v'],
+ codes: ['ShiftLeft', 'KeyV'],
+ description: 'Show or hide the reading pane',
+ },
+ ],
+ },
];
const [hoveredCodes, setHoveredCodes] = createSignal<string[]>([]);
diff --git a/apps/web/src/lib/core/hotkey/tokens.ts b/apps/web/src/lib/core/hotkey/tokens.ts
index 38d415d39e..fa183c9d38 100644
--- a/apps/web/src/lib/core/hotkey/tokens.ts
+++ b/apps/web/src/lib/core/hotkey/tokens.ts
@@ -153,6 +153,7 @@ export const TOKENS = {
blockSender: 'email.blockSender',
markSenderSignal: 'email.markSenderSignal',
markSenderNoise: 'email.markSenderNoise',
+ toggleReadingPane: 'email.toggleReadingPane',
compose: {
edit: {
recipients: 'email.compose.edit.recipients',
diff --git a/docs/agent-guide/email.md b/docs/agent-guide/email.md
index 596b4a356d..d5ebeef57a 100644
--- a/docs/agent-guide/email.md
+++ b/docs/agent-guide/email.md
@@ -249,6 +249,28 @@ The first scenario covers Signal → Noise → All after disconnecting both nati
HTTP and WebSockets. iOS shares the native cache code but is not yet covered by
that driver.
+**Reading pane.** On desktop the header's columns button (or `Shift+V`) shows
+threads beside the list instead of in its place; the choice is remembered per
+browser. The list keeps its own keys: j/k and arrows move the cursor and the
+pane follows it (replacing history rather than adding entries) while the list
+keeps focus, even if the thread is still loading; Mark done on
+the open row follows the next row (an action on another row, such as the one
+under the pointer, leaves the pane alone), and the open row keeps an accent
+marker while the pointer highlights others. Enter or a click opens the row and
+moves the keyboard into the reader, as does any click inside the reader. Its
+keys live in a child hotkey scope so they never replace the list's, and while
+it has the keyboard the list's keys stand down, so `x`, `Cmd+A`, `End` or
+`Shift+Enter` in the reader never act on the list. j/k in the reader step
+threads and move the list cursor with them, replacing history. Escape in the
+reader, once there is nothing to unwind, hands the keyboard back to the list
+without closing the thread. Narrow rows stack sender, subject and snippet.
+Without room for both (narrow split, collapsed window) the pane folds away and
+a thread replaces the list as usual; the thread remounts, but a reply draft
+survives. The divider can be dragged; the list width is remembered. Verify that
+list `e` still works after switching threads in the pane (the reader's `e` must
+not replace it), and that after j/k the grid still has focus: the next Enter
+moves into the reader without opening a reply.
+
In the new Email view, ordinary row activation opens the thread inside
`/app/component/mail`; the view breadcrumb (for example Signal) has a hover
background and returns to the filtered list. Pressing `Escape` in the open thread
@@ -295,6 +317,9 @@ does not add an accent-colored ring; keyboard focus has a neutral outline.
Replies appear inline on desktop and in a composer drawer on touch devices.
On touch, a saved reply shows as a **Draft** row with its opening words under the
message it answers (which stays expanded); tapping it reopens the draft.
+On desktop, a saved reply that reappears with its thread (opening it, stepping
+to it with j/k, the reading pane following the list) stays unfocused, so the
+next j moves on instead of typing into it; `r` or a click continues it.
Desktop draft bodies and app-controlled message text use 15px, matching channels.
HTML messages with preserved sender typography retain their explicit sizes.
Desktop reply actions sit together at the bottom right: discard, attach, schedule,