w3c / uievents

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

Need algorithm for how mouse click events are fired #197

Open garykac opened 6 years ago

garykac commented 6 years ago

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

auxclick, click, dblclick

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

garykac commented 6 years ago

This algorithm should probably include DOMActivate as well

domenic commented 6 years ago

I'm not sure mice can be separated from other pointing devices, given that click (and dblclick maybe??) apply to all of them. I know this spec doesn't define touch and pointer events, but someone needs to define what happens when you "click", including those, and this seems like the right place.

It'll also be interesting to note how this interacts with focus. The spec currently states:

The default action of the click event type varies based on the event target of the event and the value of the button or buttons attributes. Typical default actions of the click event type are as follows:

  • If the event target has associated activation behavior, the default action MUST be to execute that activation behavior (see §3.5 Activation triggers and behavior).

  • If the event target is focusable, the default action MUST be to give that element document focus.

Due to a historical quirk, the activation behavior is already in the event dispatch logic. (Although, I wonder if this correctly captures how it relates to the other events, like (pointer|touch)(down|up) or DOMActivate...). But the focus part is not, and any algorithmic description of clicking would need to include that---at which point?

This'll be really great to have written down :)

garykac commented 4 years ago

Draft algorithm for handling mouse clicks (doc in progress)