Skip to content

Commit 40cd60f

Browse files
committed
fix(desktop): stabilize branch search and tighten patch spacing
1 parent ff5cb1a commit 40cd60f

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

packages/app/e2e/regression/new-session-workspace-branch.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ test("selects a base branch for a new workspace", async ({ page }) => {
2222
pageMessages: () => ({ items: [] }),
2323
vcsBranches: ["feature/api", "main", "origin/release"],
2424
})
25+
await page.route("**/api/vcs/branches?*", (route) => {
26+
if (new URL(route.request().url()).searchParams.get("search") !== "feature") return route.fallback()
27+
return route.fulfill({ json: { location: { directory }, data: ["feature/api"] } })
28+
})
2529
await page.addInitScript(
2630
({ directory, draftID, server }) => {
2731
localStorage.setItem(
@@ -44,10 +48,28 @@ test("selects a base branch for a new workspace", async ({ page }) => {
4448
await page.getByRole("button", { name: "Local", exact: true }).click()
4549
await page.getByRole("menuitem", { name: "New worktree", exact: true }).click()
4650
await page.getByRole("button", { name: "from main", exact: true }).click()
51+
const search = page.getByRole("textbox", { name: "Search branches", exact: true })
52+
await expect(search).toBeFocused()
53+
await page.keyboard.type("feature")
54+
await expect(search).toHaveValue("feature")
55+
await expect(page.getByRole("menuitemradio")).toHaveText(["feature/api"])
56+
await expect(search).toBeFocused()
4757
await page.getByRole("menuitemradio", { name: "feature/api", exact: true }).click()
4858

4959
const selected = page.getByRole("button", { name: "from feature/api", exact: true })
5060
await expect(selected).toBeVisible()
5161
await selected.click()
62+
await expect(search).toBeFocused()
63+
await expect(search).toHaveValue("")
5264
await expect(page.getByRole("menuitemradio", { name: "feature/api", exact: true })).toBeChecked()
65+
await page.keyboard.press("Escape")
66+
await expect(selected).toBeFocused()
67+
await page.keyboard.press("Enter")
68+
await expect(search).toBeFocused()
69+
await page.keyboard.type("feature")
70+
await expect(search).toHaveValue("feature")
71+
await expect(page.getByRole("menuitemradio")).toHaveText(["feature/api"])
72+
await page.getByRole("button", { name: "Clear", exact: true }).click()
73+
await expect(search).toHaveValue("")
74+
await expect(page.getByRole("menuitemradio")).toHaveText(["feature/api", "main", "origin/release"])
5375
})

packages/app/src/new-session/workspace/selector.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ export function PromptWorkspaceSelector(props: {
255255
class="w-[243px] overflow-hidden rounded-md border-0 bg-v2-background-bg-layer-01 shadow-[var(--v2-elevation-floating)] focus:outline-none"
256256
onOpenAutoFocus={(event) => {
257257
event.preventDefault()
258-
branchSearchInput?.focus({ preventScroll: true })
258+
// Kobalte defers its list autofocus until after the focus scope opens.
259+
setTimeout(() => requestAnimationFrame(() => branchSearchInput?.focus({ preventScroll: true })))
259260
}}
260261
>
261262
<div class="flex h-7 shrink-0 items-center gap-2 rounded-sm pl-3 pr-2.5 text-v2-icon-icon-muted">

packages/session-ui/src/components/message-part.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@
13081308
flex-grow: 1;
13091309
display: flex;
13101310
align-items: center;
1311-
gap: 20px;
1311+
gap: 12px;
13121312
min-width: 0;
13131313
}
13141314

0 commit comments

Comments
 (0)