[BUG] Number keys auto-select options instead of typing in "Other" text input on AskUserQuestion prompts

Status Closed — not planned
Reported on v2.1.29
Maintainer reply None cached
Activity 4 comments · opened Feb 1, 2026 · closed Apr 2, 2026

Description

When Claude Code presents a multiple-choice question (via AskUserQuestion) with an "Other" free-text option, typing a number key (1-9) while focused on the "Other" text input immediately selects the corresponding numbered option instead of entering the digit as text.

Expected behavior

When the "Other" text input has focus, all keystrokes (including numbers) should be captured as text input. The response should only submit when the user presses Enter.

Actual behavior

Typing a number (e.g., "2") in the "Other" text input immediately selects option 2 and submits it, bypassing the text input entirely.

Reproduction steps

  1. Run Claude Code in Ghostty terminal
  2. Trigger an AskUserQuestion prompt with multiple choices (e.g., 3 options + Other)
  3. Navigate to the "Other" free-text option
  4. Type any number (e.g., "3")
  5. Observe: option 3 is immediately selected and submitted instead of "3" being entered as text

Environment

  • Claude Code version: 2.1.29
  • Terminal: Ghostty (with Kitty keyboard protocol support)
  • OS: macOS (Darwin 25.2.0)

Notes

  • This may be related to Kitty keyboard protocol handling, as Ghostty sends enhanced key sequences. However, overriding number keys to send plain ASCII via Ghostty keybinds (keybind = 1=text:1, etc.) did not resolve the issue in initial testing (pending full terminal restart to confirm).
  • The terminal has existing keybind workarounds for related Kitty protocol issues (enter, shift+enter, shift+space, kp_enter) from #17400.
  • Possibly related to #10278 (number keys in approval dialogs) and #12465 (enter key in multi-choice prompts).

View original on GitHub ↗

4 Comments

github-actions[bot] · 8 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/19182
  2. https://github.com/anthropics/claude-code/issues/16818
  3. https://github.com/anthropics/claude-code/issues/18227

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

scttbnsn · 8 months ago

Update: Ghostty keybind workaround confirmed ineffective

After a full Ghostty restart, the keybind = N=text:N workaround does not fix this issue. Ghostty's +list-keybinds confirms the overrides are active and sending plain text characters, but Claude Code still intercepts number keys as option selectors while focused in the "Other" text input.

This confirms the bug is in Claude Code's TUI input handling — number keys are being treated as option-selection shortcuts globally, regardless of whether the text input field has focus. The terminal's key encoding is not the problem.

Removing the number key keybinds from my Ghostty config since they have no effect on this issue.

himkt · 7 months ago

I just noticed (taught by @h-michael 🙏) that this problem is now resolved (I also confirmed on 2.1.76 (Claude Code)).

github-actions[bot] · 6 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.