The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(assistant-ui): keep rename editor focused while menu closes
Steven Enamakel029328ba179a
diff --git a/app/src/components/assistant-ui/thread-list.tsx b/app/src/components/assistant-ui/thread-list.tsxindex 01d9e7524d..b27f8f9bc3 100644--- a/app/src/components/assistant-ui/thread-list.tsx+++ b/app/src/components/assistant-ui/thread-list.tsx@@ -316,6 +316,7 @@ export const ThreadListItem: FC<{</ThreadListItemPrimitive.Trigger>)}<ThreadListItemMore+ isRenaming={isRenaming}onRename={() => setIsRenaming(true)}showArchive={showArchive}extras={menuExtras}@@ -390,10 +391,11 @@ const ThreadListItemRename: FC<{ onDone: (restoreFocus: boolean) => void }> = ({};const ThreadListItemMore: FC<{+ isRenaming: boolean;onRename: () => void;showArchive: boolean;extras?: ReactNode;-}> = ({ onRename, showArchive, extras }) => {+}> = ({ isRenaming, onRename, showArchive, extras }) => {const { t } = useT();return (<ThreadListItemMorePrimitive.Root sharedFocusGroup>@@ -410,6 +412,14 @@ const ThreadListItemMore: FC<{<span className="sr-only">{t('assistantUi.threadList.moreOptions', 'More options')}</span></ThreadListItemMorePrimitive.Trigger><ThreadListItemMorePrimitive.Content+ // The closed menu remains mounted during its exit animation. It must+ // not move focus away from the editor and commit a cancelled rename.+ onEscapeKeyDown={event => {+ if (isRenaming) event.preventDefault();+ }}+ onCloseAutoFocus={event => {+ if (isRenaming) event.preventDefault();+ }}side="right"align="start"sideOffset={6}diff --git a/app/test/playwright/specs/chat-thread-list-lifecycle.spec.ts b/app/test/playwright/specs/chat-thread-list-lifecycle.spec.tsindex b6aa61100c..1341185808 100644--- a/app/test/playwright/specs/chat-thread-list-lifecycle.spec.ts+++ b/app/test/playwright/specs/chat-thread-list-lifecycle.spec.ts@@ -182,16 +182,8 @@ test.describe('Chat thread list — create, deep link, rename, delete', () => {await expect(input).toBeVisible();await input.fill('this-must-not-stick-5t8y1u');- console.log('rename-focus-before-Escape', await input.evaluate(element => ({- focused: document.activeElement === element,- menus: [...document.querySelectorAll('[role="menu"]')].map(menu => ({- state: menu.getAttribute('data-state'),- slot: menu.getAttribute('data-slot'),- })),- })));-// Escape is an explicit cancel and must suppress the commit the ensuing- // blur would otherwise fire (`ThreadList.tsx:183-187`).+ // blur would otherwise fire while the closed menu animates out.await input.press('Escape');await expect(input).toHaveCount(0);