Skip to content
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

Explain how a removed DOM node should be handled for boundary events. #491

Merged
merged 2 commits into from Nov 22, 2023

Conversation

flackr
Copy link
Contributor

@flackr flackr commented Oct 31, 2023

This explains how the previous target is tracked when the previous target is removed from the DOM for #477.


Preview | Diff

This explains how the previous target is tracked when the previous
target is removed from the DOM for w3c#477.
and reset the |over child| flag to <code>false</code>.
If the |previous target| at any point will no longer be [=connected=] [[DOM]],
update the |previous target| to the nearest still [=connected=] [[DOM]] parent
following the event path corresponding to dispatching events to the previous target,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this following the event path part is a bit hand wavy. Maybe we need to expose a method which encapsulates step 5.9 of dispatching events. One of the complications to doing that is the get the parent algorithm can depend on the particular event being dispatched. I think it is the case that for all pointer events (and mouse events) the path is expected to be the same, but technically nothing stops a particular event from having a different path.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it is better to land this hand wavy patch and maybe file a followup to think about how to spec it in a more algorithmic way.

@patrickhlauke
Copy link
Member

@smaug---- @mustaqahmed thoughts on this PR?

index.html Outdated
@@ -423,7 +423,17 @@ <h3>Firing events using the <code>PointerEvent</code> interface</h3>
<p>If the event is {{GlobalEventHandlers/pointerdown}}, the associated device is a direct manipulation device, and the target is an {{Element}},
then <a>set pointer capture</a> for this <code>pointerId</code> to the target element as described in <a>implicit pointer capture</a>.

<p>Fire the event to the determined target. The user agent SHOULD treat the target as if the pointing device has moved over it for the purpose of <a data-cite="uievents/#events-mouseevent-event-order">ensuring event ordering</a> [[UIEVENTS]].</p>
<p>Fire the event to the determined target.
The user agent SHOULD treat the target as if the pointing device has moved over it from the |previous target| (or if the |over child| flag is set, over an anonymous child of |previous target|)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is an anonymous child?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to treat the pointer as if it is not yet over the parent. E.g. if you have

<div id="a">
  <div id="b">Pointer over</div>
</div>

And you remove #b while the pointer is over it, the next boundary update should dispatch pointerover #a. If we implicitly set the pointer to be over #a then we will never dispatch this - so I'm proposing that we have some state that tracks that it is like being over a child of #a - but one which doesn't actually exist in the dom to receive events - for the sake of being able to dispatch the correct boundary events on the next update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to bikeshed on better ways to describe this / or define and explain a term for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've replaced the "anonymous child" mention with a flag that directly states the over event is needed.

@patrickhlauke patrickhlauke merged commit e7aa0d9 into w3c:gh-pages Nov 22, 2023
2 checks passed
@patrickhlauke patrickhlauke added the needs-wpt Investigation whether the issue needs a wpt test has been done and wpt is missing label Nov 22, 2023
@mustaqahmed mustaqahmed removed the needs-wpt Investigation whether the issue needs a wpt test has been done and wpt is missing label Nov 22, 2023
@mustaqahmed
Copy link
Member

Removing the need-wpt label because #477 has it already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants