GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(app): preserve command selection under a stationary pointer (#60368) · jonBoone/opencode@33e495a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/app
    • component-tests
      • composer.spec.ts
    • src/composer/editor
      • editor.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/app/component-tests/composer.spec.ts‎

Copy file name to clipboardExpand all lines: packages/app/component-tests/composer.spec.ts
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,40 @@ story("keeps toolbar focus rings whole and keyboard-only", async ({ mount, page
463463
await expect(variant).toHaveCSS("outline-style", "none")
464464
})
465465

466+
story("keeps command selection on the keyboard until the pointer moves", async ({ mount, page }) => {
467+
const component = await mount("opencode-composer-flow--slash-suggestions")
468+
469+
const input = component.getByRole("textbox", { name: "Prompt", exact: true })
470+
471+
const menu = component.locator('[data-component="composer-suggestions"]')
472+
473+
const test = menu.getByRole("button", { name: "/test", exact: true })
474+
475+
const review = menu.getByRole("button", { name: "/review", exact: true })
476+
477+
await page.evaluate(() => document.fonts.ready.then(() => undefined))
478+
await expect(test).toHaveAttribute("data-active", "")
479+
480+
const box = await review.boundingBox()
481+
482+
if (!box) throw new Error("Missing review command")
483+
484+
await input.press("Escape")
485+
await expect(menu).toHaveCount(0)
486+
await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2)
487+
await input.fill("/")
488+
await expect(test).toHaveAttribute("data-active", "")
489+
await expect(review).toHaveCSS("background-color", "rgba(0, 0, 0, 0)")
490+
491+
// Layout changes can deliver pointer events without any actual mouse movement.
492+
await review.dispatchEvent("pointermove", { movementX: 0, movementY: 0 })
493+
await expect(test).toHaveAttribute("data-active", "")
494+
495+
await page.mouse.move(box.x + box.width / 2 + 2, box.y + box.height / 2)
496+
await expect(review).toHaveAttribute("data-active", "")
497+
await expect(test).not.toHaveAttribute("data-active")
498+
})
499+
466500
story("grows suggestions while preserving visible timeline context", async ({ mount }) => {
467501
const component = await mount("opencode-composer-flow--constrained-command-suggestions")
468502
const boundary = component.locator('[data-slot="composer-suggestion-boundary-story"]')
Collapse file

‎packages/app/src/composer/editor/editor.tsx‎

Copy file name to clipboardExpand all lines: packages/app/src/composer/editor/editor.tsx
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,9 +1323,11 @@ function ComposerEditorPopover(props: {
13231323
type="button"
13241324
data-suggestion-id={item.id}
13251325
data-active={props.activeID === item.id ? "" : undefined}
1326-
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"
1326+
class="flex h-7 w-full shrink-0 items-center gap-2 rounded-md px-2 py-1 text-start"
13271327
classList={{ "bg-v2-overlay-simple-overlay-hover": props.activeID === item.id }}
1328-
onPointerMove={() => props.onActiveChange(item)}
1328+
onPointerMove={(event) => {
1329+
if (event.movementX || event.movementY) props.onActiveChange(item)
1330+
}}
13291331
onClick={() => props.onSelect(item)}
13301332
>
13311333
<div class="flex min-w-0 flex-1 items-center gap-2">

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.