Skip to content

Commit 0e25f6d

Browse files
nedtwiggclaude
andcommitted
Don't steal door focus after delayed auto-spawn on detach
The auto-spawn was introduced with a 440ms delay so the kill/detach animation can finish before the new pane animates in. But detachPanel calls selectDoor(id) synchronously, then 440ms later the delayed spawn called selectPanel(newId) and stole focus off the just-detached door. Only call selectPanel if nothing is selected (the kill path clears selection before the delay). On detach the door selection stays put. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 000b4fb commit 0e25f6d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/src/components/Pond.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,12 @@ export function Pond({
14901490
paneToCopyByIdRef.current.set(id, removed.id);
14911491
freshlySpawnedRef.current.set(id, 'top-left');
14921492
e.api.addPanel({ id, component: 'terminal', tabComponent: 'terminal', title: '<unnamed>' });
1493-
selectPanel(id);
1493+
// Only steal focus if nothing is selected (i.e., the kill path, which
1494+
// clears selection). On detach the just-detached door is selected and we
1495+
// must not override that — the door retains focus per the detach UX.
1496+
if (selectedIdRef.current === null) {
1497+
selectPanel(id);
1498+
}
14941499
};
14951500
if (delay === 0) spawn();
14961501
else setTimeout(spawn, delay);

0 commit comments

Comments
 (0)