-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Order of pointerover/enter/move and corresponding mouse events is different on browsers #454
Comments
@flackr @smaug---- @mustaqahmed would be interested in your thoughts on this. i don't think there was a rationale for omitting the on the question of exact timing, I think the spec leaves that generally unspecified, only suggesting the order in that large note in https://w3c.github.io/pointerevents/#mapping-for-devices-that-do-not-support-hover ... maybe we could do with a matching note in https://w3c.github.io/pointerevents/#mapping-for-devices-that-support-hover as well? it would still be non-normative, but could at least give an indication - or the note that's currently there could be generalised to apply to both cases, with some tweaks |
The spec deliberately leaves out a direct mapping between pointer/mouse pointers for over/enter/out/leave events because the compat mouseover/enter/out/leave events must appear consistent to a mouse-events based app (that doesn't listen to Pointer Events) even when we have simultaneous primary pointers of different types ("mouse", "touch" and "pen"). The core requirement here is that the compat event sequence must consistently represent the movement of a single legacy mouse when multiple pointer-types are active at the same time. Let's look closely at an example. Consider a mouse-press on button A followed by a touch-down a button B, before neither the mouse nor the touch is released. If we ignore the compat mouse events for a moment, the outcome is obvious:
Now the compat mouse events seen by buttons A and B must include the transition of a single legacy mouse pointer from A to B before the second action, so:
Section 11.1 was added to clarify this idea but the discussion in this issue suggests that a textual description is not enough to explain the complexity here! Perhaps we need to add an example with a diagram? |
To attempt to clarify the spec, @kevers-google helped me create this CSS animation: I am proposing to add this to the spec as a helpful note. If the spec text doesn't "like" CSS animations, we can add an animated GIF instead. |
@flackr @patrickhlauke I just updated the tap timing of the above animation as per our PEWG discussion today. |
…re recognition Related to the discussion started in #454
…re recognition Related to the discussion started in #454
…re recognition Related to the discussion started in #454
* Explain the rationale/thinking behind compat events (to represent a consistent legacy mouse pointer) * Add note about high level "interleaved" events, and the reality of what user agents may do, especially on touchscreens, as long as the relative order is consistent Closes #454
* Explain the rationale/thinking behind compat events (to represent a consistent legacy mouse pointer) * Add note about high level "interleaved" events, and the reality of what user agents may do, especially on touchscreens, as long as the relative order is consistent Closes #454
* Add note about high level "interleaved" events, and the reality of what user agents may do, especially on touchscreens, as long as the relative order is consistent Closes #454
Expand explanation for compatibility mouse events Add note about high level "interleaved" events, and the reality of what user agents may do while maintaining a consistent the relative order. Closes #454 based on @mustaqahmed's suggestion
@mustaqahmed So #458 added the explanation why pointerout does not directly match to mouseout, but does it actually resolve the original post? |
@saschanaz see also #459 which I think more directly addresses the original post? |
Ah, missed that one. Thank you! |
No worries, we managed to confuse ourselves while working on these two related aspects ;) |
data:text/html,<input id=input><script>input.onpointerenter = input.onmouseenter = input.onpointerleave = input.onmouseleave = input.onpointerover = input.onmouseover = input.onpointerout = input.onmouseout = input.onpointermove = input.onmousemove = ev =>console.log(ev.type)</script>
When hovering over the input, the console output is:
Chrome: pointerover->pointerenter->mouseover->mouseenter->pointermove->mousemove->pointerout->pointerleave->mouseout->mouseleave
Firefox: pointerover->pointerenter->pointermove->mouseover->mouseenter->mousemove->pointerout->pointerleave->mouseout->mouseleave
Safari: pointerover->mouseover->pointerenter->mouseenter->pointermove->mousemove->pointerout->mouseout->pointerleave->mouseleave
Somehow the timing that pointermove and mousemove appear is different.
I'm not quite sure this grouping is specced. https://w3c.github.io/pointerevents/#mapping-for-devices-that-support-hover looks like it doesn't even give the mapping for over/enter/out/leave.
The text was updated successfully, but these errors were encountered: