FS#61047 - [atom] Middle click doesn't close tab

Attached to Project: Community Packages
Opened by Alexander Popov (AlexWayfer) - Wednesday, 12 December 2018, 17:26 GMT
Last edited by Nicola Squartini (tensor5) - Wednesday, 02 January 2019, 12:09 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Nicola Squartini (tensor5)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Steps to reproduce:

1. Click on tab via middle mouse button (wheel)

Expected behavior: Tab is closing.

Actual behavior: Tab isn't closing.

Reproduces how often: 100%


Additional info:
* package version: `1.32.2-2`
* config: even reset and in safe mode.


Reference: https://github.com/atom/tabs/issues/545
This task depends upon

Closed by  Nicola Squartini (tensor5)
Wednesday, 02 January 2019, 12:09 GMT
Reason for closing:  Fixed
Additional comments about closing:  1.33.1-2
Comment by Mathieu (mamath) - Saturday, 15 December 2018, 08:00 GMT
Reproduced with version 1.33.0-1
Comment by Konstantin Shalygin (k0ste) - Tuesday, 18 December 2018, 04:52 GMT
I have the same issue for a few weeks.
Comment by Denis Pershev (napaster) - Tuesday, 18 December 2018, 04:56 GMT
Reproduced with version 1.33.0-1
Comment by Mario (VaarSuvius) - Friday, 21 December 2018, 04:23 GMT
The culprit is Electron 3.

Electron 3 uses a newer chromium version, and chromium since version 55 seems to implement a new behaviour, where click of non-primary (such as the middle) mouse buttons do not fire the "click" event anymore, but "auxclick".

https://stackoverflow.com/questions/44578022/electron-prevent-middle-click
https://developer.mozilla.org/en-US/docs/Web/Events/auxclick

A simple fix is to add the onClick handler in the tab package not only to "click" but also to "auxclick".

A patch for the tabs package and a diff of the PKGBUILD are attached
Comment by Alexander Popov (AlexWayfer) - Friday, 21 December 2018, 08:29 GMT
> The culprit is Electron 3.

But I see Electron version 2 in the `package.json` file of Atom: https://github.com/atom/atom/blob/48618e5/package.json#L15

Does it mean that `atom` package should be locked at Electron version 2? And it doesn't use Electron 3.
Comment by Mario (VaarSuvius) - Friday, 21 December 2018, 13:16 GMT
> But I see Electron version 2 in the `package.json` file of Atom: https://github.com/atom/atom/blob/48618e5/package.json#L15
Yes, because that is, what Atom is officially bundled with, and the only version officially supported by the Atom maintainers themselves.
The Archlinux PKGBUILD applies some patches, so that actually Electron 3 is used.

> Does it mean that `atom` package should be locked at Electron version 2?
Well yes, changing the dependency from electron to electron2 in the PKGBUILD (and removing the associated patches to fix other problems with Electron 3) would be the other solution to our problem. But i have not tested that.

For me, it would be the best solution, if they would incorporate the fix in upstream, since the added line does nothing in Electron 2 but fixes the behaviour in Electron 3. But given that using any other version of Electron than the one that it is officially bundled with, i doubt that they would accept a pull request. The referenced issue on github was already closed on that grounds.
Comment by Eli Schwartz (eschwartz) - Friday, 21 December 2018, 17:19 GMT
Thanks for discovering the issue. Please submit a PR to upstream, since they usually only close issue reports due to "we're not interested in spending the time debugging your modified atom".

They should be willing to accept a PR with clearly explained rationale, that works on the current official atom release and also makes it easier for whatever future time they end up migrating to electron 3.x

As usual in the open-source world, the best way to *guarantee* that things are fixed is to take advantage of the open-source nature and implement the fix yourself. :) This goes 50x for atom... it is also what our atom maintainer usually does in this situation.
Comment by Mario (VaarSuvius) - Friday, 21 December 2018, 21:56 GMT
I have now created a PR on github here: https://github.com/atom/tabs/pull/552
We will see if they merge it.

Edit 24.2.2019: The merge request in upstream has just been merged, so with the next release of atom, our patch here should not be necessary anymore.
Comment by Nicola Squartini (tensor5) - Sunday, 30 December 2018, 13:55 GMT
Thanks Mario, I've applied your patch in 1.33.1-2.
Comment by Konstantin Shalygin (k0ste) - Monday, 31 December 2018, 03:06 GMT
atom-1.33.1-3, works for me.

Loading...