claude-code - 💡(How to fix) Fix [BUG] AskUserQuestion dialog steals focus and captures keystrokes while user is typing in VS Code [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45374Fetched 2026-04-09 08:06:54
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×5

When using Claude Code in the VS Code extension, the AskUserQuestion dialog appears while the user is actively typing in the input box (composing a new message or answering a previous question). The dialog immediately steals keyboard focus, causing keystrokes to be interpreted as option selections rather than text input. This results in unintended answers being submitted without the user's knowledge.

Root Cause

When using Claude Code in the VS Code extension, the AskUserQuestion dialog appears while the user is actively typing in the input box (composing a new message or answering a previous question). The dialog immediately steals keyboard focus, causing keystrokes to be interpreted as option selections rather than text input. This results in unintended answers being submitted without the user's knowledge.

RAW_BUFFERClick to expand / collapse

Description

When using Claude Code in the VS Code extension, the AskUserQuestion dialog appears while the user is actively typing in the input box (composing a new message or answering a previous question). The dialog immediately steals keyboard focus, causing keystrokes to be interpreted as option selections rather than text input. This results in unintended answers being submitted without the user's knowledge.

Steps to Reproduce

  1. Open Claude Code in VS Code extension
  2. Send a request that triggers Claude to work for a while
  3. Begin typing your next message or follow-up in the input box
  4. Claude invokes AskUserQuestion mid-typing
  5. Keystrokes intended for the input box are captured by the dialog and inadvertently select an option

Expected Behavior

The dialog should not accept keyboard input until the user explicitly focuses it (e.g., by clicking). Alternatively, the dialog should be queued and not appear while the input box has focus and contains text.

Actual Behavior

The dialog appears immediately, steals focus from the input box, and the next keystroke selects an option — often without the user realizing the dialog appeared.

Environment

  • Claude Code VS Code extension
  • macOS

Prior Issues

This has been reported multiple times but all prior issues are now closed:

  • #28722 — AskUserQuestion Steals Focus and Triggers Unintended Selection
  • #33988 — Permission prompt captures keystrokes while user is typing
  • #10971 — Feature request: Prevent prompts and dialogs from appearing while user is actively typing
  • #22300 — Number keys auto-select options instead of typing in "Other" text input
  • #20591 — Number hotkeys in AskUserQuestion interfere with numerical input

The problem persists as of April 2026.

extent analysis

TL;DR

The issue can be mitigated by modifying the AskUserQuestion dialog to not accept keyboard input until it is explicitly focused by the user.

Guidance

  • Review the focus management logic in the AskUserQuestion dialog to ensure it does not steal focus from the input box while the user is typing.
  • Consider adding a check to queue the dialog if the input box has focus and contains text, preventing it from appearing immediately.
  • Investigate the use of a timeout or delay before displaying the AskUserQuestion dialog to allow the user to finish typing.
  • Examine the keyboard event handling in the dialog to prevent unintended option selections.

Example

No code snippet is provided as the issue does not contain sufficient technical details.

Notes

The issue has been reported multiple times, and prior issues are closed, but the problem persists, indicating a potential need for a more fundamental solution.

Recommendation

Apply a workaround to modify the AskUserQuestion dialog's focus management and keyboard event handling to prevent unintended behavior.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING