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(email): give the list keyboard focus when it remounts (#8236)

teo9b7e9833eed7
diff --git a/apps/web/src/features/email-view/components/EmailList.tsx b/apps/web/src/features/email-view/components/EmailList.tsx
index 585b5cf4dd..d79accf9d2 100644
--- a/apps/web/src/features/email-view/components/EmailList.tsx
+++ b/apps/web/src/features/email-view/components/EmailList.tsx
@@ -18,6 +18,7 @@ import { makePersistedState } from '@app/lib/persistence';
import { PullToRefresh } from '@components/app/mobile/PullToRefresh';
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 {
type EntityData,
@@ -153,6 +154,12 @@ 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.
+ createSplitAutofocus({
+ element: () => grid() ?? null,
+ enabled: () => panel.isPanelActive() && !isTouchDevice(),
+ });
const [virtualizer, setVirtualizer] = createSignal<VirtualizerHandle>();
const [isPullRefreshing, setIsPullRefreshing] = createSignal(false);
const forceEmptyState = useDebugSetting(