AskUserQuestion keyboard input is unreliable when options include preview (side-by-side layout)
Summary
When the AskUserQuestion tool renders options that include preview content, the UI switches to a side-by-side layout (vertical option list on the left, preview pane on the right). In this layout keyboard input is broadly unreliable — only ESC works dependably (to dismiss). Arrow keys (↑/↓) to move the selection, Enter to confirm, and number keys to pick an option are all flaky or unresponsive, so the prompt effectively can only be driven with the mouse.
When the same tool renders options without preview (the plain list layout), keyboard navigation works normally.
Steps to reproduce
- Trigger an
AskUserQuestionprompt whose options each include apreviewfield (this forces the side-by-side preview layout). - Try to drive it with the keyboard — ↑/↓ to move, Enter to confirm, or a number key to select.
Expected
Keyboard navigation/selection behaves the same as in the plain (no-preview) list layout.
Actual
Only ESC is reliable. Arrow keys, Enter, and number selection are unstable/unresponsive; the prompt can realistically only be completed with the mouse. Keyboard control is effectively broken whenever previews are present.
Environment
- Claude Code
2.1.187 - WSL2 (Ubuntu) on Windows, terminal-based TUI
Notes
Reproducible every time previews are present; switching the same question to no-preview options restores normal keyboard control, so it appears specific to the side-by-side preview renderer's input handling.
Showing cached comments. Read the full discussion on GitHub ↗
3 Comments
Confirming this on Linux + tmux (issue is currently labelled
platform:wslonly), on the currentlatestbuild — with one variant worth recording: the mouse is dead too, not just the keyboard.Environment
latest)TERM=xterm-256color· pane 111x63"tui": "fullscreen"escape-time 10,focus-events off,extended-keys off,mouse off— Claude Code enables mouse reporting itself and tmux forwards it (pane reportsmouse_any_flag=1)Symptom
One question, 3 single-select options, each with a multi-line
preview→ side-by-side layout.Whenever
previewis present the picker is completely inert. From the first deliberate keypress until it suddenly wakes up, nothing registers — no arrow keys, no Enter, no number keys, no mouse click, no hover highlight. This is not intermittent flakiness inside an otherwise working picker: it is a solid dead window that ends on its own after repeated attempts, and from that moment the same picker behaves completely normally for the rest of its life.Pickers without
previewin the same sessions are never affected, so the two layouts are cleanly separable on this machine.Ruled out on this box
focus-eventsisoff, so focus-in/out is never forwarded into the pane, and the wedge occurs with no app/tab switch at all.escape-time: it is 10, not the 500ms default.claudeprocesses are not CPU-starved.The only variable that correlates here is the presence of
preview, which matches this report exactly.Likely the same root cause
Open since 2.1.187 with no changelog entry through 2.1.217. Since the side-by-side preview renderer is the only differentiator between working and broken pickers, would it be possible to review its input handling specifically?
Minimal repro, in case it helps pin down the input handler — this triggers it reliably here:
Ask Claude to call
AskUserQuestionwith one single-select question whose options each carry a multi-linepreview, e.g.Dropping
previewfrom the three options (everything else identical) makes the picker keyboard- and mouse-driveable again, which is the cleanest A/B I have.Label request: this is currently tagged
platform:wsl, but it is not WSL-specific — the report above is native Linux (Ubuntu 6.8) with tmux 3.6a, and #78306 / #79325 are macOS (PyCharm terminal and Apple Terminal, the latter with no tmux at all). Could the platform label be widened or dropped so platform-filtered triage doesn't skip it?The focus-change trigger can't be focus events — the CLI never subscribes to them
On 2.1.220 the CLI never enables focus reporting. Captured off the pty with
tmux pipe-pane -O, the complete block it emits on a keystroke is:ESC(B SI ESC[?1000h ESC[?1002h ESC[?1003h ESC[?1006h
Mouse modes only — no
ESC[?1004h, in either a healthy or a wedged session. So aterminal's focus-in/out sequences are parsed as unknown CSI and discarded; they
can't be what wedges the picker. Matches the report above that reproduced it with
tmux
focus-events off.Previews alone also didn't reproduce for me: the minimal repro from this thread
(1 question, 3 options, 4-line previews) rendered the side-by-side layout and
arrows worked 5/5 in plain tmux on 2.1.220. The second factor is real — it just
isn't focus delivery.
Signature of a wedged instance
Linux, tmux 3.6a, 2.1.220, alternate screen. Picker had previews.
produces exactly the 36-byte mode block above and nothing else.
Downas tmux named key, rawCSI B,SS3 B, aprintable char, and SGR mouse-motion reports. Attaching a real tmux client and
typing raw arrows into its pty didn't help either.
do_epoll_wait, termios byte-identical to aworking pane.
It painted but never committed
The wedged ask was rendered on screen but never written to the session
transcript, while an earlier
AskUserQuestionin the same turn was writtennormally and answered fine.
So the failure lands after paint, on a path that also does the transcript commit —
consistent with an exception in a continuation doing both the commit and the
input-handler binding, leaving a painted-but-unbound dialog. #84489 may be the
same thing with a trace attached (
VirtualMessageList: itemKeys/messages length).desync
Checking it
tmux pipe-pane -t <pane> -O 'cat > /tmp/x.raw' # idle 20s -> expect 0 bytes
tmux send-keys -t <pane> Down # 36 bytes + no repaint = wedged
grep -c '1004h' /tmp/x.raw # 0 -> focus reporting is off
(Probing trap:
Upon the first option legitimately doesn't move, which reads asa false wedge.)