button should be zero for mousemove/over/out/enter/leave |
||||||
Issue descriptionUnfortunately, each of Chrome, Edge and Firefox report the value differently. UI MouseEvent spec doesn't specify the value of |button| when the mouse is dragged with more than one buttons pressed. (Note that this is about the mousemove events only. The value is consistent for mousedown & mouseup.) [Firefox] Always have button=0 (similar to PointerEvents). [Edge] 0 [Chrome for Windows] L>M>R (if L is pressed, button=L. else if M is pressed, button=M; else button=R) [Chrome for Linux] R>M>L [Chrome for Android] 0 [Chrome for Mac] Didn't check. Even if we don't care about old mouse code, we may need to do something for (mouse-like) stylus with barrel buttons where chorded button press is very easy.
,
Feb 23 2017
,
Feb 23 2017
Just discovered that the spec is precise about it: |button| has to be zero for mousemoves. https://w3c.github.io/uievents/#event-type-mousemove So FF is correct here, both Edge & Chrome are wrong. (We matched the Chrome Android behavior to Chrome Windows yesterday on ToT :( ) I think we will file a bug for Edge.
,
Feb 23 2017
I guess changing Chrome to match the spec (and FF) is reasonable, the risk seems pretty low. If we agree, do you think we need an "intent"?
,
Feb 23 2017
Unfortunately, due to event enumeration, this is impossible to use count. :( Can you try and search the HTTPArchive a bit for usage?
,
Feb 23 2017
Find accesses to |button| from within mousemove handlers would be very tricky from http archive. I think there might be a way to use-count by adding a custom getter for |button| in MouseEvent.idl.
,
Feb 23 2017
I fear that neither use counters nor httparchive will be useful here. With use counters, you can never tell how the return value of an attribute is used, and that is all that matters here. Mere access will be tainted by enumeration (for event copying) so isn't really worth measuring in itself. For httparchive, it's also tricky to find a combination of strings that would be indicative of a problem. Once the change is made and there's a regression, however, one can search for that pattern and perhaps guess at a few others to get an idea of how widespread the problem is. Do we have any reason to think any particular behavior here is more likely to be web compatible than another, i.e. is there a most conservative approach here? Will event.buttons accurately reflect which buttons are being pressed? If so, it's probably fine if event.button in that scenario is determined in the same way as when not dragging?
,
Feb 23 2017
I agree that neither use counters nor httparchive will be useful. I don't know of any user bug despite the fact that Chrome & Edge don't agree with each other and none follow the spec. So risk is low IMO if we start following the spec. And yes, event.buttons is speced to cover the chorded buttons case. And browsers seem consistent about it: FF, Edge & Chrome all follow the spec.
,
Feb 23 2017
The risk of changing behavior in chorded scenarios is IMHO negligable (nobody really codes for chorded button scenarios). Where there is potential risk is changing button from 1 to 0 in the simple left-button-drag scenario. I suspect that we could change this alright, although note that MDN does seem to disagree with the spec here: https://developer.mozilla.org/en/docs/Web/Events/mousemove (one rule of thumb we use for "does this need an intent" is "does MDN need updating for this change"). So I guess I'd personally plan to make mousemove.button consistently 0 and err on the side of sending an intent. The other reasonable alternative is to update the spec to define some specific behavior, but I suspect there won't be much interest in adding complexity to the spec when there's no legitimate use case and no known instances of compat issues. If we find a site depending on this though, then we should definitely explore that option.
,
Feb 24 2017
Is there any argument to be made for consistency? When the mouse isn't moving, i.e. for simple clicks, is the behavior of button and buttons interoperable and well spec'd? If so, would the same rules make sense while dragging?
,
Feb 24 2017
Not moving mouse is not a problem: only mousedown & mouseup matter here, and all browsers seem spec-compliant (even for chorded buttons, in a trivial manner).
,
Feb 24 2017
Two important notes:
- The observation re Edge was wrong, I clearly messes up something: Edge always has button=0 as per the spec. So this is a chromium-only problem. And this supports our intuition that the risk of fixing that is very low.
- All movement related events in chromium are affected: button should be 0 for all of {mousemove, mouseover, mouseout, mouseenter, mouseleave}. Both FF & Edge are spec-compliant for all of these.
I will send an intent next week.
,
Feb 24 2017
,
Feb 24 2017
,
Jun 28 2018
Just confirmed that on Mac, both Chrome and Safari work perfectly: |button| is always zero for these events.
,
Jun 28 2018
Looks like the bug has been fixed: I can no longer see |button| != 0 in any of these events, test in Linux, Mac and Windows! Not sure which change fixed this.
,
Jun 28 2018
Also fixed on Android. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by foolip@chromium.org
, Feb 23 2017