From be92dada71c48aeb0f46279b2a8b3d9fd335ddf3 Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Fri, 21 Aug 2026 21:32:21 -0700 Subject: [PATCH] Move worktree palette search to top of sidebar nav The Cmd+J search button is now displayed as the first item in the sidebar navigation, improving discoverability. Styling is simplified to match the nav item layout with flex-based display and consistent spacing. --- .../components/sidebar/SidebarNav.test.tsx | 18 +++++- .../src/components/sidebar/SidebarNav.tsx | 58 +++++++++---------- 2 files changed, 45 insertions(+), 31 deletions(-) diff --git a/src/renderer/src/components/sidebar/SidebarNav.test.tsx b/src/renderer/src/components/sidebar/SidebarNav.test.tsx index 87b51ee5b23..cf4f17295b0 100644 --- a/src/renderer/src/components/sidebar/SidebarNav.test.tsx +++ b/src/renderer/src/components/sidebar/SidebarNav.test.tsx @@ -429,6 +429,20 @@ describe('SidebarNav', () => { expect(mocks.updateSettings).toHaveBeenCalledWith({ showMobileButton: false }) }) + it('places the worktree palette search above the sidebar nav rows', async () => { + const container = await renderSidebarNav() + const nav = container.querySelector('[data-contextual-tour-target="sidebar-navigation"]') + const searchButton = container.querySelector( + 'button[aria-label="Search worktrees and browser tabs"]' + ) + const tasksButton = getButtonByText(container, 'Tasks') + + expect(nav?.firstElementChild).toBe(searchButton) + expect( + searchButton?.compareDocumentPosition(tasksButton) & Node.DOCUMENT_POSITION_FOLLOWING + ).toBeTruthy() + }) + it('hides the worktree palette shortcut until the search field is hovered or focused', async () => { const container = await renderSidebarNav() @@ -439,8 +453,8 @@ describe('SidebarNav', () => { const shortcuts = searchButton?.querySelector('span.hidden') expect(shortcuts?.className).toContain('hidden') - expect(shortcuts?.className).toContain('group-hover:inline-flex') - expect(shortcuts?.className).toContain('group-focus-within:inline-flex') + expect(shortcuts?.className).toContain('group-hover:flex') + expect(shortcuts?.className).toContain('group-focus-within:flex') expect(shortcuts?.textContent).toContain('⌘') expect(shortcuts?.textContent).toContain('J') expect(searchButton?.querySelector('kbd')).toBeNull() diff --git a/src/renderer/src/components/sidebar/SidebarNav.tsx b/src/renderer/src/components/sidebar/SidebarNav.tsx index 3133f7aa6d1..c5827db332d 100644 --- a/src/renderer/src/components/sidebar/SidebarNav.tsx +++ b/src/renderer/src/components/sidebar/SidebarNav.tsx @@ -106,6 +106,35 @@ const SidebarNav = React.memo(function SidebarNav() { className="flex flex-col gap-0.5 px-2 pt-2 pb-1" data-contextual-tour-target="sidebar-navigation" > + {showArtifactsButton ? ( @@ -302,35 +331,6 @@ const SidebarNav = React.memo(function SidebarNav() { ) : null} - ) })