Repository navigation
Prevent accidental tab drags when clicking - #6210
Conversation
📝 WalkthroughWalkthroughThe change extracts the tab-drag pointer activation distance from an inline ternary in the 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
* fix(tabs): restore deferred tab activation so dragging a terminal tab doesn't switch panes mid-gesture PR #5927 shipped terminal-pane drag (reorder tabs, move a tab into another pane, edge-split into a new column). It deliberately DEFERRED tab activation to pointer-up and suppressed it during a drag, so pressing a tab to drag it never switched the active tab or stole terminal focus mid-gesture. PR #6395 (d32d62a) deleted tab-strip-pointer-activation.ts and made SortableTab/EditorFileTab/BrowserTab activate eagerly on pointerdown — fixing click-to-switch-after-reorder but regressing the drag: grabbing a tab now flips the active tab + focused pane and yanks xterm keyboard focus before the drag is even recognized (aggravated by PR #6210 raising the dnd-kit threshold 5px->12px). The move itself still lands, but the gesture feels broken. Restore the deferred-activation hook, but gate it on measured pointer DISPLACEMENT instead of the drag-active context ref the old hook used — that ref clears asynchronously relative to the drop's pointerup, which is exactly what made #6395's click-after-reorder misfire. Displacement mirrors dnd-kit's own activation threshold: a release within TAB_DRAG_ACTIVATION_DISTANCE_PX is a click (activate); crossing it is a drag (suppress). Because each press measures its own gesture, a click after a reorder always activates. - Recreate src/renderer/src/components/tab-bar/tab-strip-pointer-activation.ts (displacement-gated) + unit tests, incl. an explicit #6395 regression case. - Rewire onPointerDown in SortableTab, EditorFileTab, BrowserTab to use it. - BrowserTab.test.tsx shallow-renders via mocked React hooks; add useRef/ useCallback stubs so the new hook works under that harness. Verified end-to-end in a dev build via CDP: pressing a tab no longer activates/steals focus on pointerdown; a click still activates on release; dragging a tab into another pane still moves it; clicking tabs after a drag still switches (the #6395 guard in tests/e2e/tabs.spec.ts stays green because it uses zero-displacement clicks). 233 unit tests pass; oxlint + renderer typecheck clean. * fix: restore pane detach tab placement
* fix(tabs): restore deferred tab activation so dragging a terminal tab doesn't switch panes mid-gesture PR stablyai#5927 shipped terminal-pane drag (reorder tabs, move a tab into another pane, edge-split into a new column). It deliberately DEFERRED tab activation to pointer-up and suppressed it during a drag, so pressing a tab to drag it never switched the active tab or stole terminal focus mid-gesture. PR stablyai#6395 (04713f5) deleted tab-strip-pointer-activation.ts and made SortableTab/EditorFileTab/BrowserTab activate eagerly on pointerdown — fixing click-to-switch-after-reorder but regressing the drag: grabbing a tab now flips the active tab + focused pane and yanks xterm keyboard focus before the drag is even recognized (aggravated by PR stablyai#6210 raising the dnd-kit threshold 5px->12px). The move itself still lands, but the gesture feels broken. Restore the deferred-activation hook, but gate it on measured pointer DISPLACEMENT instead of the drag-active context ref the old hook used — that ref clears asynchronously relative to the drop's pointerup, which is exactly what made stablyai#6395's click-after-reorder misfire. Displacement mirrors dnd-kit's own activation threshold: a release within TAB_DRAG_ACTIVATION_DISTANCE_PX is a click (activate); crossing it is a drag (suppress). Because each press measures its own gesture, a click after a reorder always activates. - Recreate src/renderer/src/components/tab-bar/tab-strip-pointer-activation.ts (displacement-gated) + unit tests, incl. an explicit stablyai#6395 regression case. - Rewire onPointerDown in SortableTab, EditorFileTab, BrowserTab to use it. - BrowserTab.test.tsx shallow-renders via mocked React hooks; add useRef/ useCallback stubs so the new hook works under that harness. Verified end-to-end in a dev build via CDP: pressing a tab no longer activates/steals focus on pointerdown; a click still activates on release; dragging a tab into another pane still moves it; clicking tabs after a drag still switches (the stablyai#6395 guard in tests/e2e/tabs.spec.ts stays green because it uses zero-displacement clicks). 233 unit tests pass; oxlint + renderer typecheck clean. * fix: restore pane detach tab placement
Summary
Design / Review Pipeline
Code Review
Validation
Screenshots
Checks Run
Post-PR Stabilization