[pointerevents] Clarify `pointerleave` and `pointerout` events when first pointer move after removing an element under the pointer (#477)

masayuki-nakano has just created a new issue for https://github.com/w3c/pointerevents:

== Clarify `pointerleave` and `pointerout` events when first pointer move after removing an element under the pointer ==
I worked on fixing the failure in Firefox of `pointerevent_after_target_removed.html`. However, its expectation does not make sense. See <https://github.com/web-platform-tests/interop/issues/380> for the detail.

The main issue is, the spec does not define `pointerleave` and `pointerout` should be fired on which element(s) or should not be fired at the first move after an element under the pointer is removed.

Some definitions indicate that `pointerleave`, `pointerout`, `pointerenter` and `pointerover` should not be fired immediately (without a pointer move) when an element under the pointer is removed by a DOM API or hidden/moved by a style change. Then, web apps may want to listen to `pointerleave` and `pointerout` at next pointer move to clear something set at `pointerenter` or `pointerover`.

The spec does **not** disallow to dispatch `pointerout` on removed element (which is the last `pointerover`'ed element). Safari does that, and it seems reasonable.

The big problem here is, `pointerleave`. `pointerenter` must have been fired on the removed element and its ancestors. From web apps point of view, `pointerleave` should be fired on all elements which `pointerenter` was fired on and  are not ancestors of the element currently under the pointer. However, it sounds like terrible. To do that, browsers need to store all elements which the browser dispatched `pointerenter`, but this means that nearly root ancestors will be stored for a long time, e.g., the `<body>` element. And the dispatching code becomes complicated because DOM API may remove only some ancestors with re-connecting an ancestor to the same point.

@EdgarChen, @smaug---- 

Please view or discuss this issue at https://github.com/w3c/pointerevents/issues/477 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 21 July 2023 00:42:58 UTC