w3c / uievents

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

Element for dblclick when dblclick results of two clicks on different elements #131

Open maxired opened 7 years ago

maxired commented 7 years ago

Hi,

When reading the current working draft, it it not clear to me, how elements receiving dblclick events are choose.

Specifically, my question is, what should happen when we have two consecutive clicks on two different elements ?

From what I see :

A user agent MUST dispatch this event when the primary button of a pointing device is clicked twice over an element., but I am not sur what append when a pointing device is clicked twice over 2 different elements.

As an example, you can check https://jsfiddle.net/phaox653/ Currently, implementation of browser ( chrome, firefox, Edge, IE11) seems to trigger an dbclick event on the element which received the second click, even if it was not there for the initial one. Is this behavior respecting the spec ?

later in the spec, we can see

Each implementation will determine the appropriate hysteresis tolerance, but in general SHOULD fire click and dblclick events when the event target of the associated mousedown and mouseup events is the same element with no mouseout or mouseleave events intervening, and SHOULD fire click and dblclick events on the nearest common inclusive ancestor when the associated mousedown and mouseup event targets are different.

But still, it it not clear to me what should happen when the dblclick, is the result of two click on different elements. If I understand the spirit of the spec, the dblclick event should probably be fired on on the nearest common inclusive ancestor of the two click events. Am I correct ? Is that something that is up to the implementer ?