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

How is pointer event ctor supposed to work when coalescedEvents is passed using the PointerEventInit #223

Closed
smaug---- opened this issue Oct 6, 2017 · 16 comments
Assignees
Labels

Comments

@smaug----
Copy link
Contributor

smaug---- commented Oct 6, 2017

It isn't clear what is supposed to happen when coalescedEvents is passed using the PointerEventInit.
Does the event have some internal array of pointer events or what? Does coalescedEvents work only when type is pointermove?

Gecko bug related to this: https://bugzilla.mozilla.org/show_bug.cgi?id=1303957.
I guess we'll implement some guess what the spec might try to say

@dtapuska
Copy link

dtapuska commented Oct 6, 2017

Most Event ctor generally take the arguments as the user has specified even if they logically don't make sense. I'd expect pointer event to be like this.

@smaug----
Copy link
Contributor Author

smaug---- commented Oct 6, 2017

yeah, I'd expect that too, but the explanation of getCoalescedEvents() says
"Returns a sequence of all PointerEvents that were coalesced into the dispatched pointermove event."

What if the event wasn't dispatched at all? What if one just creates a pointer event and passes coalescedEvents in the init. What should getCoalescedEvents() return?
I'd expect the array which was passed in, but per spec that isn't suppose to happen.

@dtapuska
Copy link

dtapuska commented Oct 6, 2017

Feel free to make a pull request with some alternate text. This really shouldn't be around the getCoalesecedEvent call but really how the coalescedEvents is initialized by the user agent by default.

@NavidZ
Copy link
Member

NavidZ commented Oct 6, 2017

Regarding the event that are being created in js I remember talking to @RByers and he was saying the ctors usually don't do any checks and just initialize properties from the stuff in the dictionary. So we went with that idea and whatever you put inside the initialization dictionary will be inside the pointerevent object regardless of what js set the type of the event be or what no.
We have a test for this case but apparently I didn't stretch it enough to set all the random attributes in the coalesced event array.

@smaug----
Copy link
Contributor Author

Yeah, that sounds reasonable, but can we get that also to the spec?
Currently getCoalescedEvents() is limited to pointermove + event dispatch, and I don't understand why.

@smaug----
Copy link
Contributor Author

The spec has changed but it is still wrong. Nothing says how the data from
PointerEventInit.coalescedEvents gets to the coalesced event list .
And coalesced event list is defined to be empty if event type is pointermove or pointerrawupdate.

@NavidZ NavidZ self-assigned this Feb 19, 2020
@smaug----
Copy link
Contributor Author

https://dom.spec.whatwg.org/#inner-event-creation-steps handles the normal cases, but 'coalesced event list' isn't an attribute.

@smaug----
Copy link
Contributor Author

@annevk do you recall other cases where event contructor needs to do something special like this?

@annevk
Copy link
Member

annevk commented May 17, 2021

There's an issue with required members not working: whatwg/dom#600. (And there's whatwg/dom#606 about being more accurate about when time is captured.)

(I'm somewhat surprised this got all the way to shipping without at least some investigation into "how should this be specified".)

@annevk
Copy link
Member

annevk commented May 17, 2021

I recommend filing an issue against the DOM Standard for this so that we can consider what to do here whenever we end up reworking event construction and initialization.

@smaug----
Copy link
Contributor Author

smaug---- commented Dec 8, 2021

https://dom.spec.whatwg.org/#concept-event-constructor-ext

So pointer events spec should to define
event constructing steps for all the PointerEvents:
let coalesced events list be a clone of eventInitDicts' coalescedEvents sequence.
let predicted events list be a clone of eventInitDicts' predictedEvents sequence.

that way the event constructions steps would follow the DOM spec.

Currently PointerEvents spec has a bit hand wavy " Untrusted events have their coalesced events list initialized to the value passed to the constructor."

And I think https://github.com/web-platform-tests/wpt/blob/1408b119ac/pointerevents/pointerevent_constructor.html is a bit broken since it tests that event.target of coalesced events is updated too, but those are untrusted events, so target shouldn't be changed.

https://wpt.fyi/results/pointerevents/pointerevent_constructor.html?label=master&label=experimental&aligned&q=pointerevent_constructor.html shows that blink and gecko would need to be tweaked

smaug---- pushed a commit to smaug----/pointerevents that referenced this issue Dec 22, 2021
smaug---- pushed a commit to smaug----/pointerevents that referenced this issue Dec 22, 2021
patrickhlauke pushed a commit that referenced this issue Jan 5, 2022
…passed using the PointerEventInit (#427)

* Fix for #223, specify event constructing steps
* linkify the reference to dictionary members

Co-authored-by: smaug <[email protected]>
@patrickhlauke
Copy link
Member

did #427 fully address this issue, or is there more that needs to be done here?

@smaug----
Copy link
Contributor Author

Whoever updates the implementation first will need to tweak https://github.com/web-platform-tests/wpt/blob/1408b119ac/pointerevents/pointerevent_constructor.html

@smaug----
Copy link
Contributor Author

I'm tweaking the test on mozilla-central. I'm expecting to land the patch soon and then the test gets automatically merged to wpt.

@smaug----
Copy link
Contributor Author

web-platform-tests/wpt#32466 is the merge from mozilla-central.

@patrickhlauke
Copy link
Member

perfect, thank you @smaug----

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

No branches or pull requests

5 participants