fix(app): preserve command selection under a stationary pointer (#60368)

This commit is contained in:
usrnk1
2026-10-29 22:03:14 +01:00
committed by GitHub
Unverified
parent 06bf854d0c
commit 33e495a18f
2 changed files with 38 additions and 2 deletions
@@ -463,6 +463,40 @@ story("keeps toolbar focus rings whole and keyboard-only", async ({ mount, page
await expect(variant).toHaveCSS("outline-style", "none")
})
story("keeps command selection on the keyboard until the pointer moves", async ({ mount, page }) => {
const component = await mount("opencode-composer-flow--slash-suggestions")
const input = component.getByRole("textbox", { name: "Prompt", exact: true })
const menu = component.locator('[data-component="composer-suggestions"]')
const test = menu.getByRole("button", { name: "/test", exact: true })
const review = menu.getByRole("button", { name: "/review", exact: true })
await page.evaluate(() => document.fonts.ready.then(() => undefined))
await expect(test).toHaveAttribute("data-active", "")
const box = await review.boundingBox()
if (!box) throw new Error("Missing review command")
await input.press("Escape")
await expect(menu).toHaveCount(0)
await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2)
await input.fill("/")
await expect(test).toHaveAttribute("data-active", "")
await expect(review).toHaveCSS("background-color", "rgba(0, 0, 0, 0)")
// Layout changes can deliver pointer events without any actual mouse movement.
await review.dispatchEvent("pointermove", { movementX: 0, movementY: 0 })
await expect(test).toHaveAttribute("data-active", "")
await page.mouse.move(box.x + box.width / 2 + 2, box.y + box.height / 2)
await expect(review).toHaveAttribute("data-active", "")
await expect(test).not.toHaveAttribute("data-active")
})
story("grows suggestions while preserving visible timeline context", async ({ mount }) => {
const component = await mount("opencode-composer-flow--constrained-command-suggestions")
const boundary = component.locator('[data-slot="composer-suggestion-boundary-story"]')
+4 -2
View File
@@ -1323,9 +1323,11 @@ function ComposerEditorPopover(props: {
type="button"
data-suggestion-id={item.id}
data-active={props.activeID === item.id ? "" : undefined}
class="flex h-7 w-full shrink-0 items-center gap-2 rounded-md px-2 py-1 text-start hover:bg-v2-overlay-simple-overlay-hover"
class="flex h-7 w-full shrink-0 items-center gap-2 rounded-md px-2 py-1 text-start"
classList={{ "bg-v2-overlay-simple-overlay-hover": props.activeID === item.id }}
onPointerMove={() => props.onActiveChange(item)}
onPointerMove={(event) => {
if (event.movementX || event.movementY) props.onActiveChange(item)
}}
onClick={() => props.onSelect(item)}
>
<div class="flex min-w-0 flex-1 items-center gap-2">