Skip to content

fix(vscode): preserve worktree rename focus - #12852

Merged
marius-kilocode merged 3 commits into
mainfrom
fix-worktree-rename-focus-loss
Aug 4, 2026
Merged

fix(vscode): preserve worktree rename focus#12852
marius-kilocode merged 3 commits into
mainfrom
fix-worktree-rename-focus-loss

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

Multi-project worktree selection updates asynchronously after row clicks. Chat focus restoration can run after those acknowledgements and steal focus from the rename input, causing typing to be lost.

Preserve active editable controls during Agent Manager and prompt focus restoration while keeping the prompt input eligible for the existing chat focus behavior. Share the editable-control detection logic so both focus paths handle rename fields consistently.

Comment thread packages/kilo-vscode/webview-ui/src/utils/focus.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

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

SUGGESTION

File Line Issue
packages/kilo-vscode/webview-ui/src/utils/focus.ts 8 contenteditable === "true" attribute check misses other valid editable states; consider isContentEditable to match the pattern used elsewhere in the webview

The focus-preservation logic itself is sound: both layers (preservesTextFocus in the Agent Manager chat-focus path and ownsFocus in PromptInput) re-read document.activeElement at each scheduled retry, correctly exclude the prompt textarea, and introduce no new listeners, timers, or subscriptions (no memory-leak risk). Test covers the real implementation including the prompt-input exclusion, and a user-facing changeset is included.

Fix these issues in Kilo Cloud

Files Reviewed (5 files)
  • .changeset/worktree-rename-focus.md - 0 issues
  • packages/kilo-vscode/tests/unit/agent-manager-focus.test.ts - 0 issues
  • packages/kilo-vscode/webview-ui/agent-manager/focus.ts - 0 issues
  • packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx - 0 issues
  • packages/kilo-vscode/webview-ui/src/utils/focus.ts - 1 issue

Reviewed by kimi-k3 · Input: 96.5K · Output: 11.8K · Cached: 382.9K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit f3331c3 into main Aug 4, 2026
23 checks passed
@marius-kilocode
marius-kilocode deleted the fix-worktree-rename-focus-loss branch August 4, 2026 11:09
LudwigSolutionsAI pushed a commit to LudwigSolutionsAI/kilocode that referenced this pull request Aug 6, 2026
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…ocus-loss

fix(vscode): preserve worktree rename focus
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