Repository navigation
Keep a middle click on a tab from pasting Linux's selection into the editor - #100
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Linux, closing a tab with a middle click also pasted the last selected text (the primary selection) into the editor that had the keyboard, as irrl found.
Cause
Chromium runs Linux's middle-click paste as the default action of the middle button's
mouseup, into the focused element: here the editor, since a tab click does not take focus. The tab already cancelled the press (mousedown, so Windows and Linux do not start autoscrolling) and the click (auxclick, where it closes), but not the release. Cancellingauxclickdoes not stop the paste; cancellingmouseupdoes. That is what others found too:pasteevent into the focused element, after a middlemouseupthat no listener default-prevented.preventDefaultonauxclickdoes not stop it.preventDefaultonmouseupdoes."Fix
The tab cancels the middle button's
mouseuptoo, next to itsmousedown. It is one line on the element that takes the middle button for itself, so nothing else changes:Tested
tscandeslintpass.gs-tab-middle.mjs(web build) checks:mouseuparrives cancelledNot tested: the paste itself. It only happens on Linux with a primary selection, and this machine is a Mac. The fix rests on Chromium's behavior as quoted above.
🤖 Generated with Claude Code