From be29941e98567c6f5a0a5c8e30d2fdde9bc6dadd Mon Sep 17 00:00:00 2001 From: Priyanshu Choudhary <57816400+Priyanchew@users.noreply.github.com> Date: Sat, 23 May 2026 15:13:35 +0530 Subject: [PATCH] fix(web): add Home to location dropdown, stop auto-selecting on descend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two folder-picker UX bugs: 1. Once on a Windows drive (C:, D:), there was no way back to ~ from the dropdown — only drives were listed. Replace the "Drive" placeholder with a real "Home" option (value ~) so the dropdown always offers every root. The select's value reflects browsePath, so it reads "Home" at ~ and the drive letter inside a drive. Renamed the aria label from "Drive" to "Location" to match. 2. Double-clicking a folder to descend was silently re-selecting the folder you'd just navigated into — if it wasn't a git repo, the modal flashed a red "not a git repository" warning for every non-repo folder a user passed through. Same flaw fired on breadcrumb clicks, drive switches, and history nav. Root cause: browse() defaulted selectedPath to the navigation target. Changed the default to "" — selection is now only ever set by explicit user intent (clicking a row, the "this folder" row, or pressing Enter on a typed location). Callers that genuinely seed a selection (reset, refresh, location-input submit) already pass selectedPath explicitly, so they're unaffected. Also dropped the now-redundant selectedPath from the drive-switch call. Tests: 29/29 passing. Added two tests for the Home option (it's present and picking it routes to ~; the select value tracks browsePath) and one for the descend-doesn't-select behavior. Updated two pre-existing tests that asserted the old auto-select contract with comments explaining the new one. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../web/src/components/DirectoryBrowser.tsx | 13 ++- .../__tests__/AddProjectModal.test.tsx | 8 +- .../__tests__/DirectoryBrowser.test.tsx | 104 ++++++++++++++++++ .../__tests__/useDirectoryBrowser.test.ts | 4 +- packages/web/src/hooks/useDirectoryBrowser.ts | 7 +- 5 files changed, 127 insertions(+), 9 deletions(-) diff --git a/packages/web/src/components/DirectoryBrowser.tsx b/packages/web/src/components/DirectoryBrowser.tsx index a62dcfbbb..b358e83aa 100644 --- a/packages/web/src/components/DirectoryBrowser.tsx +++ b/packages/web/src/components/DirectoryBrowser.tsx @@ -151,15 +151,20 @@ export function DirectoryBrowser({ browser }: DirectoryBrowserProps) { {browser.roots.length > 0 ? (