From c8d4528e12638ff84376a5ebd40e0c9f4eae68d0 Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Mon, 7 Sep 2026 19:29:41 -0700 Subject: [PATCH] fix e2e create menu races --- .../src/components/sidebar/sidebar-header-actions.tsx | 4 +++- tests/e2e/worktree.spec.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/components/sidebar/sidebar-header-actions.tsx b/src/renderer/src/components/sidebar/sidebar-header-actions.tsx index ccf288355b8..d25f98700d1 100644 --- a/src/renderer/src/components/sidebar/sidebar-header-actions.tsx +++ b/src/renderer/src/components/sidebar/sidebar-header-actions.tsx @@ -49,7 +49,9 @@ function SidebarCreateMenu({ // Why: the tour highlights this trigger, so the handoff has to fire from the // menu item rather than the button that now only opens the menu. const handleCreateWorkspace = useCallback(() => { - openWorkspaceCreationComposerWithTourHandoff() + // Why: opening after Radix tears down the menu prevents its focus restoration + // from treating the new dialog as an outside interaction. + window.setTimeout(openWorkspaceCreationComposerWithTourHandoff, 0) }, []) return ( diff --git a/tests/e2e/worktree.spec.ts b/tests/e2e/worktree.spec.ts index ec49138aae5..7a394426554 100644 --- a/tests/e2e/worktree.spec.ts +++ b/tests/e2e/worktree.spec.ts @@ -459,7 +459,7 @@ test.describe('Create Workspace', () => { // portaled outside the dialog element, so locate it page-wide. const suggestion = orcaPage.getByRole('option', { name: linkedWorkspacePattern }) await expect(suggestion).toBeVisible() - await suggestion.click() + await orcaPage.keyboard.press('Enter') const createButton = dialog.getByRole('button', { name: /Create (Workspace|Worktree)/i }) await expect(createButton).toBeEnabled()