Bug 166849 - Consider implementing auxclick event
Summary: Consider implementing auxclick event
Status: RESOLVED DUPLICATE of bug 22382
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: Other
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-09 10:20 PST by Navid
Modified: 2017-01-19 17:36 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Navid 2017-01-09 10:20:18 PST
There was a new event proposed for non-primary button click actions called "auxclick" [1] and to dedicate the "click" event only to the primary button.

Both FireFox[2] and Chrome[3] shipped the feature. I was wondering if it is possible to have it implemented in WebKit as well.


[1] https://wicg.github.io/auxclick/
[2] https://hg.mozilla.org/mozilla-central/rev/ea7338a0b3de
[3] https://www.chromestatus.com/feature/5663174342737920

P.S. I wasn't sure if the component is correct or not. So I just picked the one that seems closest. Feel free to change the component to a more appropriate one.
Comment 1 David Tapuska 2017-01-09 10:29:15 PST
@cdumez: Chris do you have any position on this request?
Comment 2 Chris Dumez 2017-01-09 10:49:52 PST
Seems reasonable to me, especially if Firefox / Chrome already shipped this.
Comment 3 Chris Dumez 2017-01-09 16:47:26 PST
I tested the feature on Mac using:
- https://jsfiddle.net/ejxer8tt/2/

Firefox nightly does alert "auxclick" on two-finger click. However, it did not on Chrome Canary for some reason.

I also tested with a PC mouse (which is less common on Mac) and I got the same results when click the right button.

Seems Chrome may not support this on Mac?
Comment 4 Chris Dumez 2017-01-09 16:54:57 PST
It also seems there are some backward-compatibility risks involved since we would stop firing regular "click" events of non-LeftButton clicks, something existing content may rely on.
Comment 5 Chris Dumez 2017-01-09 17:00:30 PST
(In reply to comment #4)
> It also seems there are some backward-compatibility risks involved since we
> would stop firing regular "click" events of non-LeftButton clicks, something
> existing content may rely on.

Hmm, actually https://jsfiddle.net/ejxer8tt/6/ seems to show that Safari was not fixing "click" events on right clicks anyway.
Comment 6 Navid 2017-01-09 17:00:59 PST
I double checked with Chrome. The reason you don't see this on Chrome is due to contextmenu. Context menu on Mac opens after down and so it prevents the page from seeing mouseup and then the click/auxclick. FF as oppose to Chrome does not consider the context menu as something that covers the whole page and consumes all the events.

Anyhow, beside that difference in contextmenu which I'm not sure if we can solve as part of the auxclick, Chrome does send auxclick when the page receives both down and up for a non-primary button. You can see this by preventDefaulting the contextmenu event like as I did here:

https://jsfiddle.net/ejxer8tt/3/

It worked both for the two finger click on the touch pad or for a PC mouse (middle and right buttons) connected to a Mac.
Comment 7 Navid 2017-01-16 10:53:56 PST
@Chris, did what I say address your concern? Does the proposal/spec look reasonable?
Comment 8 Alexey Proskuryakov 2017-01-19 17:36:01 PST

*** This bug has been marked as a duplicate of bug 22382 ***