Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Fix tab close on middle click for Electron 3 - #552

Merged
daviwil merged 1 commit into
atom:masterfrom
VarNepvius:fix-middleclick-for-electron-3
Jan 24, 2019
Merged

daviwil merged 1 commit into
atom:masterfrom
VarNepvius:fix-middleclick-for-electron-3

Conversation

@VarNepvius

Copy link
Copy Markdown
Contributor

Description of the Problem

When using Atom with Electron 3, a middle click does not close a tab. This happens, because Electron 3 is based on a Chrome version >= 55. Since then, Chrome changed how click events work. Non-primary clicks now fire the event auxclick rather than click.

See https://developers.google.com/web/updates/2016/10/auxclick and https://developer.mozilla.org/en-US/docs/Web/Events/auxclick for more information on the event.

Description of the Change

This PR adds the onClick handler of TabBarView also as listener to the auxclick event.

Alternate Designs

None

Benefits

The change fixes the problem for Electron 3 while it does have no effect in Electron 2, since the auxclick event never fires in this version.

This helps with a future migration of Atom to Electron 3 and fixes the issue for unofficial distributions using Electron 3 now.

Possible Drawbacks

None

Applicable Issues

fixes #545

@eli-schwartz

Copy link
Copy Markdown

One unofficial distribution using electron 3 today is Arch Linux: https://bugs.archlinux.org/task/61047

@eli-schwartz eli-schwartz mentioned this pull request Dec 23, 2018
59 tasks done
@daviwil

daviwil commented Jan 24, 2019

Copy link
Copy Markdown
Contributor

Thanks a lot, @VarNepvius! Verified that this fixes the issue on a build of Atom on Electron 3 and it also doesn't have any negative side effects on Atom 1.34.0 stable.

@daviwil
daviwil merged commit 949a38d into atom:master Jan 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Middle click doesn't close tab

3 participants