Repository navigation
Description
Area
apps/web — Create Worktree dialog
Steps to reproduce
- Open Create worktree for a project with more than a few branches.
- Under Create From, select Branch.
- Click a branch in the list under Search branches (for example
feature-PFS-2272-alpha). - Click the branch again, double-click it, or press Escape.
Expected behavior
After a branch is picked, the list closes and the field shows the chosen branch, as a combo box does.
Actual behavior
The list stays open. The picked row is highlighted, Name is filled in, and Reuse branch appears, but nothing closes the list. Closing and reopening the dialog or restarting the app gives the same result. Because the list looks like an open combo box, the user thinks the choice was not accepted and does not continue to Create worktree.
Impact
Users can't tell whether the branch choice took effect, so they stop at this step. The selection does work (see the workaround below), which the UI doesn't make clear.
Version and environment
BiBCode Windows desktop 0.10.2 (Windows 11 Pro 26200). The reporter says macOS doesn't show it; see the platform note below.
Workaround
- The branch is already selected once its row is highlighted and Reuse branch appears. Click Create worktree (or press Ctrl+Enter) and ignore the open list.
- To close the list, type the exact branch name into Search branches. The list hides when the text exactly matches a ref, and that also selects the branch.
Investigation note
This isn't a popup or combo box. It is an inline <div> of buttons in apps/web/src/components/CreateWorktreeDialog.tsx:
const branchRows = useMemo(
() => (mode === "branch" && exactBranchRef === null ? filterRefsByQuery(refs, sourceText) : []),
...
);
...
{mode === "branch" && branchRows.length > 0 ? ( <div className="... max-h-48 overflow-y-auto ..."> ...It renders whenever Branch mode is on and the search text (sourceText) doesn't exactly match a ref name. Clicking a row calls handleBranchSelect, which updates projectSelection.branchRefName, the suggested name and the reuse flag but leaves sourceText unchanged. So exactBranchRef stays null and the list stays rendered. Nothing in the component closes it, and Escape has no handler for the list. The Smart tab works the same way: its rows stay visible after a click.
Platform note: this code path doesn't depend on the platform, and I found no Windows-specific branch. If macOS seems unaffected, the user probably typed the exact branch name there, which hides the list. It would help to confirm on macOS by clicking a row with an empty or partial search.
Existing tests (CreateWorktreeDialog.test.tsx, e.g. "turns an exact remote ref into the selection without duplicating it below the input") cover only the exact-match hide. No test covers the list after a click.
Suggested fix (for discussion)
Option A: after a row is clicked, set the search text to the chosen ref's name. The existing exact-match path then hides the list and shows the selection in the field. Editing the text clears the selection through handleSourceTextChange and brings the list back.
Option B: replace the inline list with a real combobox (popup with Escape and outside-click dismissal).
Option A is the smallest change and reuses current behaviour. Add a test that clicks a branch row and checks that the list is gone and the field shows the branch name. Review against UI.md: the selected state must be visible without an open list.
Activity