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

'Retargeting steps' run at wrong time #561

Closed
smaug---- opened this issue Jan 11, 2018 · 4 comments
Closed

'Retargeting steps' run at wrong time #561

smaug---- opened this issue Jan 11, 2018 · 4 comments
Labels
topic: events topic: shadow Relates to shadow trees (as defined in DOM)

Comments

@smaug----
Copy link
Collaborator

All the retargeting should happen before event is being handled, since event handling may change the underlying DOM and that way affect to the retargeting.

Touch event specific bug, w3c/touch-events#92

@annevk annevk added the topic: shadow Relates to shadow trees (as defined in DOM) label Jan 11, 2018
@annevk
Copy link
Member

annevk commented Jan 11, 2018

This also affects w3c/uievents#157.

cc @hayatoito @rniwa @travisleithead

@annevk
Copy link
Member

annevk commented Mar 8, 2018

Here's an idea:

  • Instead of relatedTarget on events and event paths we rename that to relatedTargets (plural). It's a list of null/EventTarget objects.
  • Events with a relatedTarget member set it to a list containing a single item. Touch events set it to a list containing all the targets of the various Touch objects (this is a fixed list).
  • Then we make all the operations operating on relatedTarget work on a sequence instead.

I think this works since relatedTarget and touch events are mutually exclusive. Even if they weren't though, this could still work by relatedTarget just occupying a special slot.

The complexity here is that UI Events and Touch Events need to initialize relatedTargets properly, but that's all the complexity they need to worry about. Everything else can be done by the DOM Standard.

(I was initially thinking of handling Touch targets separately, but that just leads to a lot of duplication, so I think the above approach is preferable if it indeed works.)

cc @whatwg/components

@annevk
Copy link
Member

annevk commented Mar 8, 2018

Ah, this does require event objects that support related targets to implement "initialize related target steps" which is passed path's relatedTargets. That way we can update what gets exposed. That still seems reasonable.

@annevk
Copy link
Member

annevk commented Mar 8, 2018

Actually, even that isn't necessary if they just make those attributes reflect the internal relatedTargets slot. That is a little special for events and might require some constructor special casing though.

annevk added a commit that referenced this issue Mar 8, 2018
This makes it work for touch events.

Tests: ...

Fixes part of #561.
annevk added a commit that referenced this issue Mar 14, 2018
This makes it work for touch events.

Tests: ...

Fixes part of #561.
annevk added a commit that referenced this issue Mar 27, 2018
This makes it work for touch events.

Tests: ...

Fixes part of #561.
@annevk annevk closed this as completed in fc16564 Mar 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: events topic: shadow Relates to shadow trees (as defined in DOM)
Development

No branches or pull requests

2 participants