Skip to content

fix(vscode): prevent selector popover clipping in new worktree dialog - #12007

Merged
marius-kilocode merged 3 commits into
mainfrom
fix-agent-manager-modal-regression
Jul 7, 2026
Merged

fix(vscode): prevent selector popover clipping in new worktree dialog#12007
marius-kilocode merged 3 commits into
mainfrom
fix-agent-manager-modal-regression

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Problem

In the Agent Manager New Worktree dialog, the reasoning-variant and mode dropdowns were clipped by the dialog's scroll containers, cutting off rows at the top of the popup (the variant picker's top option was not visible).

Before:

dyn-effda9f482805cff8722ebc0719af9ff

After:
dyn-b97c322171a8e30c31b841699069b828

Why this happened

The dialog renders the model, reasoning-variant, and mode pickers inline (portal={false}) instead of portaled to document.body. That's deliberate: portaled popovers land under the dialog's modal overlay, which swallows their clicks, so the pickers render inside the dialog DOM and rely on CSS to escape the dialog's clipping.

The escape hatch keyed only on model-selector-popover (agent-manager.css). When the variant and mode pickers were later added to the dialog, no matching rule was added, so their popovers were clipped by .am-nv-dialog-content { overflow-y: auto } and .am-prompt-input-container { overflow: hidden }.

Change

Generalize the :has() escape rules to target any [data-component="popover-content"] inside the dialog, so all inline selector popovers (model, variant, mode, and future ones) escape the scroll containers while open. Popover content unmounts on close (Kobalte default), so the overflow: visible override only applies while a dropdown is open and the dialog scrolls normally otherwise.

Regression coverage

Adds a visual-regression story (AgentManager / NewWorktreeDialog — variant dropdown open, 1280px viewport) that renders the real NewWorktreeDialog and opens the variant picker via the openVariantPicker event. Verified locally that it reproduces the clipping with the CSS reverted and renders fully with the fix applied. CI will generate the Linux baseline on push.

Manual verification

  • Opened the New Worktree dialog in a Storybook + Playwright run: all three variant rows render fully above the trigger with the fix.
  • Reverted the CSS and re-screenshotted: the dropdown is clipped at the prompt container edge (matches the reported regression).
  • bun run typecheck, bun run lint, bun run format clean in packages/kilo-vscode/.

The New Worktree dialog renders model, reasoning-variant, and mode pickers
inline (portal=false) so clicks aren't swallowed by the modal overlay. The
CSS overflow escape hatch that lets an open popover break out of the dialog's
scroll containers keyed only on model-selector-popover, so the variant and
mode dropdowns added later were clipped by .am-nv-dialog-content and the
prompt container.

Generalize the :has() rules to any popover-content inside the dialog. Popover
content unmounts on close, so the override only applies while a dropdown is open.

Add a visual-regression story (NewWorktreeDialog with the variant dropdown
open) that reproduces the clipping without the fix and covers all inline
pickers going forward.
Comment thread packages/kilo-vscode/webview-ui/src/stories/agent-manager.stories.tsx Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file in latest commit)
  • packages/kilo-vscode/webview-ui/src/stories/agent-manager.stories.tsx - fixes the previously flagged unbounded requestAnimationFrame polling loop by adding an attempt cap (120) and an onCleanup(() => cancelAnimationFrame(frame)); no new issues introduced
Previous Review Summaries (2 snapshots, latest commit 6bb3608)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 6bb3608)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/src/stories/agent-manager.stories.tsx 948 Unbounded requestAnimationFrame polling loop with no attempt cap or onCleanup (unchanged by latest commit)
Files Reviewed (2 files in latest commit)
  • packages/kilo-vscode/webview-ui/src/stories/agent-manager.stories.tsx - refactored the variant-dropdown story to hand-render the dialog's scroll-container markup with the real ThinkingSelectorBase instead of mounting NewWorktreeDialog via the dialog provider, so the screenshot capture (#storybook-root) reliably includes the popover; no new issues introduced, previously flagged rAF polling loop persists unchanged
  • .../new-worktree-variant-dropdown-1280-chromium-linux.png - new visual-regression baseline (CI-generated, not reviewed)

Fix these issues in Kilo Cloud

Previous review (commit a5df5bc)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/src/stories/agent-manager.stories.tsx 944 Unbounded requestAnimationFrame polling loop with no attempt cap or onCleanup
Files Reviewed (3 files)
  • .changeset/am-dialog-popover-clipping.md - no issues
  • packages/kilo-vscode/webview-ui/agent-manager/agent-manager.css - no issues
  • packages/kilo-vscode/webview-ui/src/stories/agent-manager.stories.tsx - 1 issue

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-5-20260630 · Input: 24 · Output: 4.2K · Cached: 500.1K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode force-pushed the fix-agent-manager-modal-regression branch 2 times, most recently from 6bb3608 to 65c4538 Compare July 7, 2026 12:45
@marius-kilocode
marius-kilocode enabled auto-merge July 7, 2026 12:46
The dialog.show() approach portaled the dialog to document.body (outside
#storybook-root), and Kobalte's modal set aria-hidden on #storybook-root,
causing Playwright's toHaveScreenshot to time out (element not visible).

Replace with an inline fixture that reproduces the real CSS clipping chain:
.am-nv-dialog > .am-nv-dialog-content > .am-prompt-input-container (position:
relative, overflow: hidden from agent-manager.css) with the real inline
ThinkingSelectorBase (portal={false}). The variant picker opens upward; with
the overflow escape fix the popover renders fully above the container, without
it floating-ui repositions the popover lower. The screenshot baseline captures
the fixed state and catches any regression.
@marius-kilocode
marius-kilocode force-pushed the fix-agent-manager-modal-regression branch from 65c4538 to 0ab3702 Compare July 7, 2026 12:47
@marius-kilocode
marius-kilocode merged commit 056386b into main Jul 7, 2026
23 checks passed
@marius-kilocode
marius-kilocode deleted the fix-agent-manager-modal-regression branch July 7, 2026 12:53
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…al-regression

fix(vscode): prevent selector popover clipping in new worktree dialog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants