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(task-compose): fix tab nav and max height (#3509)
Seamus86423cd1d2de
diff --git a/js/app/packages/app/component/split-layout/components/PopoverSplitRenderer.tsx b/js/app/packages/app/component/split-layout/components/PopoverSplitRenderer.tsxindex 22eeee5ffb..283538bb6f 100644--- a/js/app/packages/app/component/split-layout/components/PopoverSplitRenderer.tsx+++ b/js/app/packages/app/component/split-layout/components/PopoverSplitRenderer.tsx@@ -130,7 +130,11 @@ function PopoverSplitModal(props: {bindHotKeyDom(r);}}>- <Panel depth={2} active class="rounded-xl">+ <Panel+ depth={2}+ active+ class="rounded-xl *:max-h-[75vh] bottom-(--virtual-keyboard-height,0)"+ ><SplitPanelContext.Provider value={stubPanelContext}><SoupContextProvider><Show when={props.popover.mount}>diff --git a/js/app/packages/block-md/component/ComposeTask.tsx b/js/app/packages/block-md/component/ComposeTask.tsxindex 90572bd132..fa4f91291c 100644--- a/js/app/packages/block-md/component/ComposeTask.tsx+++ b/js/app/packages/block-md/component/ComposeTask.tsx@@ -594,10 +594,20 @@ export function ComposeTask(props: ComposeTaskProps) {if (!(root && container)) return;const tabbables = tabbable(container);const ndx = tabbables.indexOf(root);- const next = (ndx + dir + tabbables.length) % tabbables.length;- const elem = tabbables.at(next);++ let elem: Element | undefined;+ if (ndx >= 0) {+ // Editor is in tabbable list, navigate relative to it+ const next = (ndx + dir + tabbables.length) % tabbables.length;+ elem = tabbables.at(next);+ } else {+ // Editor not in tabbable list (contenteditable edge case)+ // Go to first element when moving forward, last when moving backward+ elem = dir === 1 ? tabbables.at(0) : tabbables.at(-1);+ }+if (elem) {- elem.focus();+ (elem as HTMLElement).focus();e.preventDefault();e.stopPropagation();}@@ -747,7 +757,39 @@ export function ComposeTask(props: ComposeTaskProps) {onPropertyDeleted={() => {}}saveHandler={saveHandler}>- <div class="flex min-h-7 flex-row flex-wrap items-center gap-2 text-sm m-px">+ <div+ class="flex min-h-7 flex-row flex-wrap items-center gap-2 text-sm m-px"+ on:keydown={(e) => {+ const target = e.target as HTMLElement;+ const container = e.currentTarget;+ const tabbables = tabbable(container);+ const isFirst = tabbables.indexOf(target) === 0;+ const isLast =+ tabbables.indexOf(target) === tabbables.length - 1;++ // Shift+Tab or ArrowUp on first property -> focus editor+ if (+ isFirst &&+ ((e.key === 'Tab' && e.shiftKey) || e.key === 'ArrowUp')+ ) {+ const editor = bodyEditor();+ if (editor) {+ e.preventDefault();+ e.stopPropagation();+ editor.focus(undefined, { defaultSelection: 'rootEnd' });+ }+ }++ // Tab or ArrowDown on last property -> let tabbable handle or wrap+ if (+ isLast &&+ ((e.key === 'Tab' && !e.shiftKey) || e.key === 'ArrowDown')+ ) {+ // Allow default Tab behavior to continue to next focusable+ // element outside this container+ }+ }}+ ><For each={properties()}>{(property) => (<InlinePropertyValuediff --git a/js/app/packages/block-md/component/InlinePropertyValue.tsx b/js/app/packages/block-md/component/InlinePropertyValue.tsxindex 44755d0fd3..9cfdc5c2e6 100644--- a/js/app/packages/block-md/component/InlinePropertyValue.tsx+++ b/js/app/packages/block-md/component/InlinePropertyValue.tsx@@ -49,6 +49,7 @@ export const InlinePropertyValue: Component<InlinePropertyValueProps> = ('inline-flex items-center gap-1.5 min-w-0 ring ring-edge-muted','px-2 py-1 leading-tight text-left rounded-full','bg-surface',+ 'focus-visible:bg-active focus-visible:ring-accent/10',{'hover:bg-hover': !isReadOnly(),'text-ink-extra-muted': isEmpty(),diff --git a/js/app/packages/core/component/HoverCard.tsx b/js/app/packages/core/component/HoverCard.tsxindex bed44d0bfa..b49a122c18 100644--- a/js/app/packages/core/component/HoverCard.tsx+++ b/js/app/packages/core/component/HoverCard.tsx@@ -49,6 +49,8 @@ type HoverCardComponentProps = {triggerAs?: 'span' | 'div';/** Class applied to the underlying trigger element. */triggerClass?: string;+ /** Tab index for the trigger element. Use -1 to remove from tab order. */+ triggerTabIndex?: number;/** Whether to disable the hover card */disabled?: boolean;/** Callback when open state changes */@@ -168,6 +170,7 @@ export function HoverCard(props: HoverCardComponentProps) {as={props.triggerAs ?? 'span'}class={props.triggerClass}disabled={isDisabled()}+ tabIndex={props.triggerTabIndex}>{props.trigger}</KobalteHoverCard.Trigger>diff --git a/js/app/packages/core/component/LexicalMarkdown/plugins/await/awaitPlugin.ts b/js/app/packages/core/component/LexicalMarkdown/plugins/await/awaitPlugin.tsindex 595770283f..53ce3b0baa 100644--- a/js/app/packages/core/component/LexicalMarkdown/plugins/await/awaitPlugin.ts+++ b/js/app/packages/core/component/LexicalMarkdown/plugins/await/awaitPlugin.ts@@ -54,7 +54,6 @@ function $findAwaitNodeByAwaitId(awaitId: string): AwaitNode | null {}export function awaitPlugin() {- console.log('using await plugin');return (editor: LexicalEditor) => {return mergeRegister(editor.registerCommand(diff --git a/js/app/packages/core/component/UserIcon.tsx b/js/app/packages/core/component/UserIcon.tsxindex 0262e1b9af..da485652ca 100644--- a/js/app/packages/core/component/UserIcon.tsx+++ b/js/app/packages/core/component/UserIcon.tsx@@ -260,6 +260,7 @@ function UserAvatarWithTooltip(props: {onOpenChange={setOpen}triggerAs="div"triggerClass={props.triggerClass}+ triggerTabIndex={-1}trigger={props.avatar}content={props.renderContent(() => setOpen(false))}/>diff --git a/js/app/packages/property/src/core/Root.tsx b/js/app/packages/property/src/core/Root.tsxindex 6097bea33f..1afb09ffac 100644--- a/js/app/packages/property/src/core/Root.tsx+++ b/js/app/packages/property/src/core/Root.tsx@@ -40,6 +40,29 @@ export function Root(props: PropertyRootProps) {if (scoped) setPortalMount(scoped);});+ // Focus restoration helper - used by both closeEditor and onOpenChange+ // When a value is saved, the component may remount (due to reactive updates),+ // so we fall back to finding the trigger by property ID if the anchor is stale.+ const restoreFocusToAnchor = () => {+ const propertyId = local.property.propertyId;+ const anchor = editorAnchor();++ setTimeout(() => {+ // First try the stored anchor if it's still in the DOM+ if (anchor?.isConnected) {+ anchor.focus();+ return;+ }++ // Fallback: find the trigger by property ID (handles remount case)+ const root = document.querySelector(`[data-property-id="${propertyId}"]`);+ const trigger = root?.querySelector('button');+ if (trigger) {+ trigger.focus();+ }+ }, 0);+ };+const value: PropertyRootContextValue = {property: () => local.property,canEdit: () => local.canEdit ?? false,@@ -59,15 +82,23 @@ export function Root(props: PropertyRootProps) {},closeEditor: () => {setEditorOpen(false);+ restoreFocusToAnchor();},portalMount,};+ const handleOpenChange = (open: boolean) => {+ setEditorOpen(open);+ if (!open) {+ restoreFocusToAnchor();+ }+ };+return (<PropertyRootContext.Provider value={value}><Dropdownopen={editorOpen()}- onOpenChange={setEditorOpen}+ onOpenChange={handleOpenChange}getAnchorRect={() => editorAnchor()?.getBoundingClientRect()}placement="bottom-start">