[BUG] Desktop app: a plugin Pane loses the focus when the clicked Button leaves the next drawing, so the next click does nothing
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
In the desktop app's Code mode, a plugin Pane loses the focus when the Button that was just clicked is not in the next drawing. The pane's isFocused prop turns false about 10 ms after the press redraws. The next click anywhere in the pane only brings the focus back: no ui.press is raised for it. So every second click on such a control does nothing.
What Should Happen?
The focus stays in the pane when the focused element leaves, as it does in the terminal, and the next click presses what it lands on.
Error Messages/Logs
None. A trace from the plugin's ui.render hook and press handler shows the pattern for each click on an unselected tab:
17:49:52.535 press tab-prs
17:49:52.541 draw tab=prs focused=true
17:49:52.552 draw tab=prs focused=false
17:49:53.071 draw tab=prs focused=true <- a click that raised no press
17:49:53.783 press tab-needsYou
17:49:53.788 draw tab=needsYou focused=true
17:49:53.800 draw tab=needsYou focused=false
Steps to Reproduce
- A plugin draws tabs in a
Pane: the shown tab asText, each other tab as aButtonthat switches to it by writing a$.statevalue the render reads.
<Box flexDirection="row" gap={2}>
{['a', 'b', 'c'].map(id =>
id === shown ? (
<Text key={id} bold>{id}</Text>
) : (
<Button key={id} label={id} onPress={() => void setShown(id)} />
),
)}
</Box>
- Open the pane in a desktop Code-mode session.
- Click
b. The tabs switch. - Click
c. Nothing happens. - Click
cagain. The tabs switch.
Claude Model
Not model-related.
Is this a regression?
Don't know.
Claude Code Version
2.1.293, as bundled by the Claude desktop app 2.31226.0
Platform
Anthropic API
Operating System
macOS 15.7.3
Terminal/Shell
Claude desktop app, Code mode.
Additional Information
What keeps the focus. Pressing a Button that stays in the next drawing under the same key keeps it, also when the redraw changes that Button's variant or plain.
Workaround. Draw the shown tab as a Button under the same key as when it was unselected.