Skip to content

workspace: Stop middle-click event propagation on tab close#49305

Merged
probably-neb merged 1 commit intozed-industries:mainfrom
ArthurDEV44:fix/middle-click-tab-close-paste
Mar 30, 2026
Merged

workspace: Stop middle-click event propagation on tab close#49305
probably-neb merged 1 commit intozed-industries:mainfrom
ArthurDEV44:fix/middle-click-tab-close-paste

Conversation

@ArthurDEV44
Copy link
Copy Markdown
Contributor

@ArthurDEV44 ArthurDEV44 commented Feb 16, 2026

Summary

  • On Linux, middle-clicking a tab to close it also triggered a paste of the primary selection into the editor behind it, because the event bubbled to the editor's mouse_up() handler
  • Added cx.stop_propagation() in the on_aux_click handler in pane.rs after closing the tab, matching the pattern already used by the editor's own middle-click handler in element.rs:1037

Closes #47381

Test plan

  • cargo test -p workspace passes (124 tests, 0 failures)
  • Select text in editor (filling primary selection), middle-click a tab to close it → tab closes, no paste in the editor behind
  • Middle-click inside the editor area → still pastes from primary selection as expected

Release Notes:

  • Fixed middle-click on a tab to close it also pasting into the editor on Linux.

On Linux, middle-clicking a tab to close it also triggered a paste of the
primary selection into the editor behind it, because the event bubbled to
the editor's mouse_up handler. Add cx.stop_propagation() after closing
the tab, matching the pattern already used by the editor's own
middle-click handler in element.rs.

Closes #47381
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Feb 16, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @ArthurDEV44 on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Feb 16, 2026
@ArthurDEV44
Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Feb 16, 2026
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Feb 16, 2026

The cla-bot has been summoned, and re-checked this pull request!

@probably-neb
Copy link
Copy Markdown
Collaborator

Nice catch, thanks!

@probably-neb probably-neb merged commit 8dbef08 into zed-industries:main Mar 30, 2026
38 checks passed
@probably-neb
Copy link
Copy Markdown
Collaborator

@zed-zippy approved

piper-of-dawn pushed a commit to piper-of-dawn/zed that referenced this pull request Apr 25, 2026
…stries#49305)

## Summary

- On Linux, middle-clicking a tab to close it also triggered a paste of
the primary selection into the editor behind it, because the event
bubbled to the editor's `mouse_up()` handler
- Added `cx.stop_propagation()` in the `on_aux_click` handler in
`pane.rs` after closing the tab, matching the pattern already used by
the editor's own middle-click handler in `element.rs:1037`

Closes zed-industries#47381

## Test plan

- [x] `cargo test -p workspace` passes (124 tests, 0 failures)
- [x] Select text in editor (filling primary selection), middle-click a
tab to close it → tab closes, no paste in the editor behind
- [x] Middle-click inside the editor area → still pastes from primary
selection as expected

Release Notes:

- Fixed middle-click on a tab to close it also pasting into the editor
on Linux.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Closing a terminal tab with middle click also pastes behind it

2 participants