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(cmd+k): menu scroll on hover (#3951)
Seamus0824dc53759d
diff --git a/js/app/packages/app/component/command/CommandItem.tsx b/js/app/packages/app/component/command/CommandItem.tsxindex 7745021b87..d7845d3cd7 100644--- a/js/app/packages/app/component/command/CommandItem.tsx+++ b/js/app/packages/app/component/command/CommandItem.tsx@@ -48,7 +48,7 @@ function CommandItemHotkey(props: { item: CommandMenuItem }) {Boolean(sequence()?.length);const StepHotkey = (step: DisplayHotkeyStep) => (- <div class="p-2 py-0.5 border border-edge-muted rounded-xs">+ <div class="p-2 py-0.5 border border-edge-muted rounded-md"><Hotkeytoken={step.token}shortcut={step.shortcut}@@ -63,7 +63,7 @@ function CommandItemHotkey(props: { item: CommandMenuItem }) {<Showwhen={sequence()?.length}fallback={- <div class="p-2 py-0.5 border border-edge-muted rounded-xs">+ <div class="p-2 py-0.5 border border-edge-muted rounded-md"><Hotkeytoken={token()}shortcut={shortcut()}diff --git a/js/app/packages/app/component/command/CommandMenu.tsx b/js/app/packages/app/component/command/CommandMenu.tsxindex 67825c0421..0cc0452455 100644--- a/js/app/packages/app/component/command/CommandMenu.tsx+++ b/js/app/packages/app/component/command/CommandMenu.tsx@@ -132,11 +132,14 @@ export function CommandMenuInner(props: {? undefined: useCommandItems(query, CommandState.categoryFilter);const filteredItems = props.items ?? defaultFilteredItems!;+ const [shouldScrollSelectedIntoView, setShouldScrollSelectedIntoView] =+ createSignal(false);createEffect(() => {const items = filteredItems();const current = CommandState.selectedIndex();if (current >= items.length && items.length > 0) {+ setShouldScrollSelectedIntoView(false);CommandState.setSelectedIndex(items.length - 1);}});@@ -145,6 +148,7 @@ export function CommandMenuInner(props: {on([query, CommandState.categoryFilter], () => {const items = filteredItems();const firstIsSearch = items[0] && isSearchItem(items[0]);+ setShouldScrollSelectedIntoView(false);CommandState.setSelectedIndex(firstIsSearch && items.length > 1 ? 1 : 0);}));@@ -297,6 +301,7 @@ export function CommandMenuInner(props: {keyDownHandler: () => {const items = filteredItems();if (items.length === 0) return false;+ setShouldScrollSelectedIntoView(true);CommandState.setSelectedIndex((prev) => (prev + 1) % items.length);return true;},@@ -311,6 +316,7 @@ export function CommandMenuInner(props: {keyDownHandler: () => {const items = filteredItems();if (items.length === 0) return false;+ setShouldScrollSelectedIntoView(true);CommandState.setSelectedIndex((prev) => (prev - 1 + items.length) % items.length);@@ -436,6 +442,7 @@ export function CommandMenuInner(props: {function handleMouseEnter(index: number) {if (isKeyboardActive()) return;+ setShouldScrollSelectedIntoView(false);CommandState.setSelectedIndex(index);}@@ -563,6 +570,7 @@ export function CommandMenuInner(props: {handleItemAction(item, openInNewSplit)}onMouseEnter={handleMouseEnter}+ scrollSelectedIntoView={shouldScrollSelectedIntoView()}/></Show></div>@@ -571,10 +579,10 @@ export function CommandMenuInner(props: {<Panel.Footer class="gap-4 px-4 bg-surface text-xs text-ink-extra-muted/80"><span class="flex items-center gap-1"><div class="flex gap-1">- <div class="flex border border-edge-muted text-xxs rounded-xs items-center px-1.5 py-px font-normal">+ <div class="flex border border-edge-muted text-xxs rounded-md items-center px-1.5 py-px font-normal"><Hotkey shortcut={navUpHotkey.hotkey()} class="space-x-1" /></div>- <div class="flex border border-edge-muted text-xxs rounded-xs items-center px-1.5 py-px font-normal">+ <div class="flex border border-edge-muted text-xxs rounded-md items-center px-1.5 py-px font-normal"><Hotkey shortcut={navDownHotkey.hotkey()} class="space-x-1" /></div></div>@@ -661,12 +669,18 @@ function VirtualizedCommandList(props: {selectedIndex: number;onSelect: (item: CommandMenuItem, openInNewSplit: boolean) => void;onMouseEnter: (index: number) => void;+ scrollSelectedIntoView: boolean;}) {let virtualizerHandle: VirtualizerHandle | undefined;createEffect(() => {const index = props.selectedIndex;- if (index < 0 || index >= props.items.length || !virtualizerHandle) {+ if (+ !props.scrollSelectedIntoView ||+ index < 0 ||+ index >= props.items.length ||+ !virtualizerHandle+ ) {return;}// Skip when all items fit: scrolling would be a no-op at the final@@ -709,7 +723,7 @@ function VirtualizedCommandList(props: {function HotkeyHint(props: { command: RegisterHotkeyReturn; label: string }) {return (<span class="flex items-center gap-1">- <div class="flex border border-edge-muted text-xxs rounded-xs items-center px-1.5 py-px font-normal">+ <div class="flex border border-edge-muted text-xxs rounded-md items-center px-1.5 py-px font-normal"><Hotkey shortcut={props.command.hotkey()} class="space-x-1" /></div>{props.label}