w3c / uievents

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

Need algorithm for how mouse events are fired #196

Open garykac opened 6 years ago

garykac commented 6 years ago

We need a algorithmic description of how mouse events are fired.

mousedown, mouseenter, mouseleave, mousemove, mouseout, mouseover, mouseup

See https://w3c.github.io/uievents/#events-mouseevent-event-order

Starting point:

1   mousemove       
(Pointing device is moved into element A...)
2   mouseover   A   
3   mouseenter  A   
4   mousemove   A   Multiple mousemove events
(Pointing device is moved out of element A...)
5   mouseout    A   
6   mouseleave  A   
domenic commented 6 years ago

This runs into the tricky area of hit-testing, which we probably should leave for another time. But we'll want to at least roughly gesture in the direction of what "into element A" / "out of element A" mean.

For example, one interpretation is that given A nested inside B nested inside C, you're moving into A, B, and C, each of which fires a bubbling event, so that you get three mouseovers on C (1 directly + 1 bubbled from A + 1 bubbled from B). I'm pretty sure that's not what browsers do. Is the algorithm instead something like "the deepest thing in the DOM tree"?

garykac commented 5 years ago

TPAC discussion doc: https://docs.google.com/document/d/1AoNnGTGabWOQoAH-M34Jdw2rbbwb_pSZz2-69mysx_U/edit