Skip to content

Fix tab switching after missed drag cleanup - #6392

Merged
Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/cant-switch-tabs
Jun 26, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/cant-switch-tabs

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • clear tab drag state if Electron/dnd-kit misses the normal drag end/cancel callback
  • install the fallback cleanup synchronously on drag start so fast drag releases cannot beat a passive effect
  • keep normal drag/drop behavior intact by cancelling the fallback during normal drag-end cleanup
  • add hook and Electron E2E coverage for tab clicks after drag gestures

Why

A missed dnd-kit cleanup can leave tabDragActiveRef.current stuck true. Once stuck, later tab clicks look like drag releases and tab activation is suppressed, which matches the “worked initially, then stopped switching tabs” failure mode.

Test Plan

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/tab-group/useTabDragSplit.test.ts src/renderer/src/components/tab-bar/tab-strip-pointer-activation.test.tsx (16 passed)
  • pnpm exec playwright test tests/e2e/tabs.spec.ts --config tests/playwright.config.ts --project electron-headless --grep "clicking tabs still switches after a tab drag gesture releases" --workers=1 (1 passed)
  • pnpm run typecheck:web
  • pnpm exec oxlint src/renderer/src/components/tab-group/useTabDragSplit.ts src/renderer/src/components/tab-group/useTabDragSplit.test.ts tests/e2e/tabs.spec.ts

Review Notes

  • A subagent review flagged a possible passive-effect race in the first version of this PR. This revision fixes that by installing the fallback listener inside onDragStart before returning control to the event loop.
  • The hook tests now cover same-turn pointerup, pointercancel, blur, and a normal drag end while the fallback timer is pending.
  • I also launched a copied-profile dev Orca from this branch for manual testing against a clone of the current main Orca profile.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a86e5043-2ef8-4e27-bc11-c64f4e183bd5

📥 Commits

Reviewing files that changed from the base of the PR and between 4a489327fbce475fee63ed79c5765b606b884cf3 and b8a67e9.

📒 Files selected for processing (3)
  • src/renderer/src/components/tab-group/useTabDragSplit.test.ts
  • src/renderer/src/components/tab-group/useTabDragSplit.ts
  • tests/e2e/tabs.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/e2e/tabs.spec.ts

📝 Walkthrough

Walkthrough

The tab-drag hook now adds global pointerup, pointercancel, and blur listeners during an active drag and uses a zero-delay timer to clear drag state if the drag end event is missed. The hook tests cover the missed-end cleanup path and drag completion behavior. The tab E2E test now checks that tab activation still works after a completed drag gesture.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary, motivation, testing, and review notes, but omits required Screenshots, AI Review Report, Security Audit, and Notes sections. Add the missing template sections, including screenshots or 'No visual change', an AI Review Report, a Security Audit, and Notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main fix: restoring tab switching after missed drag cleanup.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Jinwoo-H
Jinwoo-H force-pushed the Jinwoo-H/cant-switch-tabs branch from 4a48932 to b8a67e9 Compare June 26, 2026 00:33
@Jinwoo-H
Jinwoo-H merged commit b651b4b into main Jun 26, 2026
1 check passed
@Jinwoo-H
Jinwoo-H deleted the Jinwoo-H/cant-switch-tabs branch June 26, 2026 00:43
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant