w3c / uievents

UI Events
https://w3c.github.io/uievents/
Other
147 stars 52 forks source link

> Overall, Firefox is the most consistent. Ctrl+click and 2-finger-click should act the same, but Chrome and Safari are not. Safari should send auxclick for non-primary mouse clicks. #334

Open mohamedmosseb opened 2 years ago

mohamedmosseb commented 2 years ago

Overall, Firefox is the most consistent. Ctrl+click and 2-finger-click should act the same, but Chrome and Safari are not. Safari should send auxclick for non-primary mouse clicks.

Note that after https://bugzilla.mozilla.org/show_bug.cgi?id=1615732 Firefox dispatches mousedown/mouseup with button=0 (instead of button=2) for Ctrl+click, so we would dispatch click event then instead. 2-finger trackpad click behaves the same (mousedown/mouseup with button=2 and auxclick).

I test with https://domeventviewer.com/mouse-event-viewer.html on Firefox Nightly again.

Firefox = Nightly 80.0a1 (2020-06-29)

Click

type button buttons ctrlKey
mousedown 0 1 false
mouseup 0 0 false
click - 0 false

Ctrl+click

When the contextmenu handler calls preventDefault: type button buttons ctrlKey
mousedown 0 1 true
contextmenu - 1 true
mouseup 0 0 true
click - 0 true

2-finger trackpad click

When the contextmenu handler calls preventDefault: type button buttons ctrlKey
mousedown 2 2 false
contextmenu - 2 false
mouseup 2 0 false
auxclick - 0 false

Originally posted by @EdgarChen in https://github.com/w3c/uievents/issues/265#issuecomment-652347442