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

Synthetic click activation steps should state whether the event is composed or not #578

Closed
rniwa opened this issue Sep 28, 2016 · 16 comments

Comments

@rniwa
Copy link
Collaborator

rniwa commented Sep 28, 2016

To run synthetic click activation steps or more broadly the definition of firing a click event should clarify when if ever the event is fired with composed flag set to true.

Also, the definition of initializing an event should take composed as an argument.

As things stand, the specifications are extremely unclear about when & how this flag is set.

@rniwa
Copy link
Collaborator Author

rniwa commented Sep 28, 2016

@rniwa
Copy link
Collaborator Author

rniwa commented Sep 28, 2016

Note that the last test case in event-composed.html tests that composed flag is set to true when a synthetic click event is fired via HTMLElement.prototype.click.

@annevk
Copy link
Collaborator

annevk commented Sep 28, 2016

"initialize" is used to define initEvent() and similar legacy methods. It doesn't need updating. Just use event constructors (which do take a composed dictionary member in the second argument).

I agree that we should clarify "click" however. And I think it should be composed because it's user input. We mainly considered UI Events and forgot HTML dispatches some of those too.

@rniwa
Copy link
Collaborator Author

rniwa commented Sep 28, 2016

Well, UI events already spec that user-initiated click is composed. The question is whether synthetic click event fired by HTMLElement.prototype.click should be composed or not.

@annevk
Copy link
Collaborator

annevk commented Sep 29, 2016

We also fire a synthetic click for keyboard-initiated "clicks", no? In any event, I think they should be composed.

@hayatoito
Copy link
Contributor

hayatoito commented Oct 4, 2016

An UI Event which is not dispatched via new Event("", {...}) should be composed, I think.

In other words, if users do not have any chance to specify whether the event is composed or not via an explicit parameter, it should be considered composed.

@rniwa
Copy link
Collaborator Author

rniwa commented Oct 5, 2016

In other words, if users do not have any chance to specify whether the event is composed or not via an explicit parameter, it should be considered composed.

That's a pretty good easy-to-follow principle!

@annevk
Copy link
Collaborator

annevk commented Oct 5, 2016

But that only applies to non-synthetic UI events, right?

@hayatoito
Copy link
Contributor

Ah, yeah. I have found that element.click() does not dispatch trusted events.
It is a synthetic event, but users do not have a chance to specify it is whether composed or not.

We have a kind of contradiction. :(

@rniwa
Copy link
Collaborator Author

rniwa commented Oct 5, 2016

That's okay. The principle you stated in #578 (comment) doesn't concern trusted-ness at all. The only question is whether author script can specify composed or not. It can't so it must be composed unless we're adding a new option to click() e.g. click({composed: true}).

@annevk
Copy link
Collaborator

annevk commented Oct 6, 2016

How do you tell something is a UI event? But yeah, given what @smaug---- said elsewhere about his views on click() it would not make sense for it to use composed.

@smaug----
Copy link

Not sure how my comment elsewhere about click() applies here. Hadn't thought about .composed. I don't have strong opinion on this. #578 (comment) doesn't sound bad, so click() would dispatch .composed set to true.

@annevk
Copy link
Collaborator

annevk commented Sep 4, 2017

Do we still want to flip this? What do implementations do and do we have tests? HTML still ends up setting composed to false by not talking about it.

@annevk
Copy link
Collaborator

annevk commented Sep 4, 2017

Ah okay, we have a test at https://github.com/w3c/web-platform-tests/blob/master/shadow-dom/event-composed.html#L76 as pointed out earlier.

@annevk
Copy link
Collaborator

annevk commented Sep 4, 2017

WebKit fails that test and Chrome passes it. It seems that everyone thinks it should be composed so I'll fix that.

annevk added a commit to whatwg/html that referenced this issue Sep 4, 2017
Tests: see shadow-dom/event-composed.html in web-platform-tests.

Fixes WICG/webcomponents#578 and part of #1922.
@rniwa
Copy link
Collaborator Author

rniwa commented Sep 5, 2017

The implementation bug in WebKit is tracked as https://bugs.webkit.org/show_bug.cgi?id=170211.

annevk added a commit to whatwg/html that referenced this issue Sep 6, 2017
Tests: see shadow-dom/event-composed.html in web-platform-tests.

Fixes WICG/webcomponents#578 and part of #1922.
alice pushed a commit to alice/html that referenced this issue Jan 8, 2019
Tests: see shadow-dom/event-composed.html in web-platform-tests.

Fixes WICG/webcomponents#578 and part of whatwg#1922.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants