-
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
Clarify pointerleave
and pointerout
events when first pointer move after removing an element under the pointer
#477
Comments
Below are my comments/questions to aid the discussion:
Hmm, I added this test to match the expectation in a user reported Chrome bug. I haven't looked into all the details you mentioned above, but I can see that
Yes, and one reason is that the text in PointerEvents depends on the hand-wavy definition in UI Event Spec.
After the element is removed from DOM, my quick read of DOM event dispatch algorithm suggests that the algorithm shouldn't do anything at least because One question is: does WebKit dispatch the
Chrome does not store all elements, instead keeps track of the last known "element under pointer" then infers about exited/enter elements using the common ancestor of previous vs current "element under pointer" in the current DOM. The big comment in the common ancestor code implies it's a legacy Chrome behavior to "match Firefox and IE". |
The test expects that same kind of events are dispatched with same event order between mouse events and pointer events. Historically,
On the other hand, I.e., they are fired in the different rules, but the test expects same result between mouse events and pointer events.
I think that it's fine to dispatch DOM events in a document fragment. An orphan node can be treated as the root element of a document fragment. Then, event phase can be set as same as when the node is in the owner document. (I.e., if browsers dispatch a DOM event on an orphan node, only the target phase will appear.)
According to the test result (only
Firefox does similar thing. Firefox stores both elements under the cursor which are targeted by I think that Chrome dispatches |
I left my recommendation in web-platform-tests/interop#380 (comment) TLDR, i think that on node removal we should track the nearest still attached node as the one the pointer is over. This will result in correct pointer counts when we subsequently dispatch boundary events. |
Decided during PEWG meeting at TPAC: Leaving this issue open until we have at least one browser that includes the proposed fix/behaviour |
We still need WPTs around shadow-DOM boundary and slot elements. |
For Shadow DOM if the removed node is topmost element in Shadow DOM, we probably want to find the nearest shadow-including inclusive ancestor Element, and otherwise just find parent the same way how event path would find a "parent".' Or should we rely on event path? |
It looks like step dispatching events defines how the event path is constructed. In the case of node removal we don't have a current event so we should follow the algorithm there for finding the nearest still attached parent that would be in the event path. |
This explains how the previous target is tracked when the previous target is removed from the DOM for w3c#477.
While reviewing the fix @mustaqahmed is working on, I also discovered that when we remove nodes during the dispatch of boundary events we still send events to the removed nodes. E.g. load https://jsbin.com/rawogov/edit?html,css,js,output and move the mouse from the blue box up. The green removed box still gets an event. I think this is also in violation of the ui-events section which states:
|
Thanks for pointing out the violation of the spec. Chrome had an old comment to investigate its boundary event dispatch algorithm, see the bug we just filed. |
Closing, just needs WPT |
From @mustaqahmed
|
Looks like @masayuki-nakano addded this WPT to cover the shadow-dom case: https://github.com/web-platform-tests/wpt/blob/master/pointerevents/pointerevent_pointer_boundary_events_after_removing_last_over_element.html We still need a WPT for slot elements. |
@masayuki-nakano would it be easy to just tweak those tests a tiny bit to cover also slots? |
Yeah, I think so, but could you clarify what cases do you want? |
I guess there should be tests for removing an assigned node (so removing a light DOM node, which is assigned to a slot), and also test a case where slot has assigned nodes and then the slot itself is removed from shadow DOM. |
This CL adds tests for two untested aspects of PointerEvents in slots: - PE event sequence around slots when the shadow DOM remains unchanged. - Boundary events after modifications to slotted elements. This covers the last remaining WPT for: w3c/pointerevents#477 Bug: 40156858 Change-Id: I9823595a0b15672d0395d4e117ccc6462c3e42f2
This CL adds tests for two untested aspects of PointerEvents in slots: - PE event sequence around slots when the shadow DOM remains unchanged. - Boundary events after modifications to slotted elements. This covers the last remaining WPT for: w3c/pointerevents#477 Bug: 40156858 Change-Id: I9823595a0b15672d0395d4e117ccc6462c3e42f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5598510 Commit-Queue: Mustaq Ahmed <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1313570}
This CL adds tests for two untested aspects of PointerEvents in slots: - PE event sequence around slots when the shadow DOM remains unchanged. - Boundary events after modifications to slotted elements. This covers the last remaining WPT for: w3c/pointerevents#477 Bug: 40156858 Change-Id: I9823595a0b15672d0395d4e117ccc6462c3e42f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5598510 Commit-Queue: Mustaq Ahmed <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1313570}
Done landing WPTs for slotted elements: web-platform-tests/wpt#46694 |
Related to: w3c/pointerevents#477 Bug: 40156858 Change-Id: Ia7b952a48b89a6d932a3a4d71f36e8086d261c48
Related to: w3c/pointerevents#477 Bug: 40156858 Change-Id: Ia7b952a48b89a6d932a3a4d71f36e8086d261c48 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5622053 Commit-Queue: Mustaq Ahmed <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1313946}
Related to: w3c/pointerevents#477 Bug: 40156858 Change-Id: Ia7b952a48b89a6d932a3a4d71f36e8086d261c48 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5622053 Commit-Queue: Mustaq Ahmed <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1313946}
…ted elements., a=testonly Automatic update from web-platform-tests WPT coverage for Pointer Events for slotted elements. This CL adds tests for two untested aspects of PointerEvents in slots: - PE event sequence around slots when the shadow DOM remains unchanged. - Boundary events after modifications to slotted elements. This covers the last remaining WPT for: w3c/pointerevents#477 Bug: 40156858 Change-Id: I9823595a0b15672d0395d4e117ccc6462c3e42f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5598510 Commit-Queue: Mustaq Ahmed <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1313570} -- wpt-commits: b8aab6837b61aacee4cbad1fbb6aeb3952af7b60 wpt-pr: 46694
…ted elements., a=testonly Automatic update from web-platform-tests WPT coverage for Pointer Events for slotted elements. This CL adds tests for two untested aspects of PointerEvents in slots: - PE event sequence around slots when the shadow DOM remains unchanged. - Boundary events after modifications to slotted elements. This covers the last remaining WPT for: w3c/pointerevents#477 Bug: 40156858 Change-Id: I9823595a0b15672d0395d4e117ccc6462c3e42f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5598510 Commit-Queue: Mustaq Ahmed <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1313570} -- wpt-commits: b8aab6837b61aacee4cbad1fbb6aeb3952af7b60 wpt-pr: 46694
…ted elements., a=testonly Automatic update from web-platform-tests WPT coverage for Pointer Events for slotted elements. This CL adds tests for two untested aspects of PointerEvents in slots: - PE event sequence around slots when the shadow DOM remains unchanged. - Boundary events after modifications to slotted elements. This covers the last remaining WPT for: w3c/pointerevents#477 Bug: 40156858 Change-Id: I9823595a0b15672d0395d4e117ccc6462c3e42f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5598510 Commit-Queue: Mustaq Ahmed <mustaqchromium.org> Reviewed-by: Robert Flack <flackrchromium.org> Cr-Commit-Position: refs/heads/main{#1313570} -- wpt-commits: b8aab6837b61aacee4cbad1fbb6aeb3952af7b60 wpt-pr: 46694 UltraBlame original commit: 60779ff43603360d82107deb6ca1cd519fa169d8
…to shadow-host and slot, a=testonly Automatic update from web-platform-tests PointerEvent WPT: add checks for events to shadow-host and slot Related to: w3c/pointerevents#477 Bug: 40156858 Change-Id: Ia7b952a48b89a6d932a3a4d71f36e8086d261c48 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5622053 Commit-Queue: Mustaq Ahmed <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1313946} -- wpt-commits: a3831b7add5dc42c1daf38a93e827710f8839576 wpt-pr: 46697
…to shadow-host and slot, a=testonly Automatic update from web-platform-tests PointerEvent WPT: add checks for events to shadow-host and slot Related to: w3c/pointerevents#477 Bug: 40156858 Change-Id: Ia7b952a48b89a6d932a3a4d71f36e8086d261c48 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5622053 Commit-Queue: Mustaq Ahmed <mustaqchromium.org> Reviewed-by: Robert Flack <flackrchromium.org> Cr-Commit-Position: refs/heads/main{#1313946} -- wpt-commits: a3831b7add5dc42c1daf38a93e827710f8839576 wpt-pr: 46697 UltraBlame original commit: 828793bbbe3b5a092eddaa5191a34d2c818deb35
…to shadow-host and slot, a=testonly Automatic update from web-platform-tests PointerEvent WPT: add checks for events to shadow-host and slot Related to: w3c/pointerevents#477 Bug: 40156858 Change-Id: Ia7b952a48b89a6d932a3a4d71f36e8086d261c48 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5622053 Commit-Queue: Mustaq Ahmed <mustaqchromium.org> Reviewed-by: Robert Flack <flackrchromium.org> Cr-Commit-Position: refs/heads/main{#1313946} -- wpt-commits: a3831b7add5dc42c1daf38a93e827710f8839576 wpt-pr: 46697 UltraBlame original commit: 828793bbbe3b5a092eddaa5191a34d2c818deb35
…to shadow-host and slot, a=testonly Automatic update from web-platform-tests PointerEvent WPT: add checks for events to shadow-host and slot Related to: w3c/pointerevents#477 Bug: 40156858 Change-Id: Ia7b952a48b89a6d932a3a4d71f36e8086d261c48 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5622053 Commit-Queue: Mustaq Ahmed <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1313946} -- wpt-commits: a3831b7add5dc42c1daf38a93e827710f8839576 wpt-pr: 46697
…to shadow-host and slot, a=testonly Automatic update from web-platform-tests PointerEvent WPT: add checks for events to shadow-host and slot Related to: w3c/pointerevents#477 Bug: 40156858 Change-Id: Ia7b952a48b89a6d932a3a4d71f36e8086d261c48 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5622053 Commit-Queue: Mustaq Ahmed <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#1313946} -- wpt-commits: a3831b7add5dc42c1daf38a93e827710f8839576 wpt-pr: 46697
I worked on fixing the failure in Firefox of
pointerevent_after_target_removed.html
. However, its expectation does not make sense. See web-platform-tests/interop#380 for the detail.The main issue is, the spec does not define
pointerleave
andpointerout
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
andpointerover
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 topointerleave
andpointerout
at next pointer move to clear something set atpointerenter
orpointerover
.The spec does not disallow to dispatch
pointerout
on removed element (which is the lastpointerover
'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 whichpointerenter
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 dispatchedpointerenter
, 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----
The text was updated successfully, but these errors were encountered: