Skip to content

fix(web): prevent selection paste when middle-click closing panel tabs - #17864

Closed
extoci wants to merge 1 commit into
pingdotgg:mainfrom
extoci:t3/overnight-middle-click-tabs-15939-retry
Closed

extoci wants to merge 1 commit into
pingdotgg:mainfrom
extoci:t3/overnight-middle-click-tabs-15939-retry

Conversation

@extoci

@extoci extoci commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Problem

On Linux, middle-clicking a right panel tab to close it can also paste the primary selection into the focused composer. The tab cancels middle-button mousedown and auxclick, but Chromium pastes on mouseup before auxclick runs.

Fixes #15939.

Change

Reuse the existing middle-button default guard for both mousedown and mouseup, with a name that covers both events. Keep closing in auxclick. This applies to every shared web/Electron right panel tab, including main's draggable tabs. Left and right clicks, activation, close controls, and drag handlers remain unchanged.

Scope and approval

This is a small fix for an unintended paste during the existing middle-click-close action. It qualifies for the focused obvious-bug exception. It changes one file and does not add a broader middle-click policy or address the separate timeline issue #15531.

Verification

Focused checks on the rebased branch passed:

  • corepack pnpm exec vp test run apps/web/src/components/RightPanelTabs.test.tsx apps/web/src/components/RightPanelTabs.keyboard.test.tsx apps/web/src/rightPanelStore.test.ts, 3 files and 112 tests passed.
  • corepack pnpm --filter @t3tools/web typecheck
  • corepack pnpm exec vp lint apps/web/src/components/RightPanelTabs.tsx, exit 0 with an existing warning in the untouched effect at line 443.
  • corepack pnpm exec vp fmt --check apps/web/src/components/RightPanelTabs.tsx
  • git diff --check

The existing tests cover tab logic and keyboard interactions; they do not prove native primary-selection behavior. Browser use and clipboard access were not authorized, so no Linux native clipboard reproduction or before/after recording is included. The code cancels mouseup at the same event stage as the existing terminal primary-selection guard.

Model: GPT-6.1 Sol, high reasoning effort. Harness: Codex through T3 Code.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Oct 10, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 9769af6

Macroscope's review found this PR approvable — This is a narrowly scoped one-file fix that prevents middle-button mouseup defaults on existing panel tabs, addressing Linux primary-selection paste while preserving tab closing and other click behavior. It introduces no schema, security, deployment, default-setting, or static-analysis changes.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 13f99752-53ed-4fa9-ac53-b0654cd0bbe4

📥 Commits

Reviewing files that changed from the base of the PR and between 50647de and 9769af6.


📒 Files selected for processing (1)
  • apps/web/src/components/RightPanelTabs.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.



📝 Walkthrough

Walkthrough

Right panel tabs now prevent the browser’s default middle-button action on both mousedown and mouseup. The mouseup prevention occurs before auxclick.

Changes

Right panel tab middle-click

Layer / File(s) Summary
Prevent default middle-button actions
apps/web/src/components/RightPanelTabs.tsx
The middle-button handler was renamed and now prevents the default action on both mousedown and mouseup.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: juliusmarminge


Merge Risk: ⚪ Minimal · up to 9769a

The change targets unwanted Linux middle-click paste while retaining the tab-close handler. No concrete merge-blocking issue is established.

Pre-merge checks | Passed 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title is concise, specific, and accurately summarizes the primary fix for Linux selection paste during middle-click tab closure.
Description check Passed The description covers the problem, change, scope rationale, verification results, and known testing limitations. It does not include the template-requested before/after UI evidence, but the omission …
Linked Issues check Passed Issue [#15939] requires middle-click tab closure without primary-selection paste into a focused composer on Linux. The PR summary states that preventTabMiddleClickDefault now prevents the middle-but…
Out of Scope Changes check Passed The reported change is limited to apps/web/src/components/RightPanelTabs.tsx with four additions and two removals. It renames the existing middle-click guard and applies it to mouseup in addition …

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Copy link
Copy Markdown
Member

Note

This comment is posted by Julius' dot

Closing because the changed middle-click interaction has no before/after recording, and the PR explicitly says its tests do not verify native primary-selection paste. The verification requirement calls for evidence of that behavior. Add a short Linux recording showing the unintended paste before the fix and a tab closing without pasting after it, then request reconsideration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Middle-click closing a right panel tab also pastes the primary selection into the composer on Linux

2 participants