-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Make command events not composed #11255
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
base: main
Are you sure you want to change the base?
Conversation
Based on feedback here, there may be a better alternative to making this event composed: whatwg#11148
I assume tests will need to be updated too? |
In particular https://github.com/web-platform-tests/wpt/blob/master/html/semantics/the-button-element/command-and-commandfor/button-event-dispatch.html will need to be refactored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is editorially fine. OP needs to be completed and I recall @smaug---- raising concerns about this earlier. Is he okay with this now?
If we are planning to change .source attribute handling to be similar to .relatedTarget, then this is fine (event would propagate if .target and .source are in different subtrees). |
@alice has been exploring solutions for reference target #11148 (comment) |
Is this something relatedTarget does? I was trying to understand how related target affects event propagation, but I couldn't decipher it from the text. |
If we want to make it work similar to relatedTarget that would be a bit more work. See https://dom.spec.whatwg.org/#concept-event-dispatch for how we deal with relatedTarget today. |
@annevk Could you explain how relatedTarget affects dispatch in non-spec terms? I've read through the spec a bunch of times, but I'm sadly none the wiser. |
At this point I would have to deduce it from first principles again as well I'm afraid. |
My reading of this WPT is that Worked example of event dispatch steps with relatedTargetIf I run through the event dispatch steps on the example from #11148 (comment) with the <outer-component id="outerComponent">
<!-- outer shadow --><template shadowRootMode="open">
<button id="relatedTarget">Foo</button>
<middle-component id="middleComponent">
<!-- middle shadow --><template shadowRootMode="open" shadowRootReferenceTarget="innerComponent">
<inner-component id="innerComponent">
<!-- inner shadow --><template shadowRootMode="open" shadowRootReferenceTarget="target">
<div id="target"></div>
</template>
</inner-component>
</template>
</middle-component>
</template>
</outer-component> Dispatching event (with 4. Let relatedTarget be the result of retargeting event’s relatedTarget against target.
6. If target ( 6.3. Append to an event path with event, target ( 6.8. Let parent be the result of invoking target’s get the parent with event.
6.9. While parent ( 6.9.3. Let relatedTarget be the result of retargeting event’s relatedTarget (
6.9.6. If parent ( 6.9.6.2. Append to an event path with event, parent ( 6.9.7 Otherwise, if parent is relatedTarget, then set parent to null.
6.9.8. Otherwise:
6.9.9. If parent (
6.10. Let clearTargetsStruct be the last struct in event’s path whose shadow-adjusted target is non-null.
6.11. If clearTargetsStruct’s shadow-adjusted target (
6.13. For each struct of event’s path, in reverse order: [fire at capturing/target phase] 6.14. For each struct of event’s path: [fire at target/bubbling phase] 7-13. [cleanup, run activation behaviour and return with clearTargets set to true] The only time relatedTarget seems to actually impact the event path is step 6.9.7:
This seems to have been added in whatwg/dom@afac504, with the commit message:
We might (?) need to handle a similar case here, but I don't think that logic is sufficient for how we'd like to propagate events with a |
I think web-platform-tests/wpt#52276 should cover the test changes? |
I can't edit OP so I'll just comment the relevant links. Chromium Implementation Bug: https://issues.chromium.org/u/1/issues/414826954 WebKit Implementation Bug: https://bugs.webkit.org/show_bug.cgi?id=292368 Firefox Implementation Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1856430 (meta bug for whole feature) |
Thanks luke! I put your links in the description |
Adding "do not merge yet" as it seems like we need to figure out to what extent we need the same model as event's relatedTarget concept has. |
Do we need to work out the specifics to that before we change the composedness? I think it'd be good to change this sooner rather than later? |
I suppose I'll defer to @smaug---- on that, though generally we don't want the specification to be in a known in-between state. |
Based on feedback here, there may be a better alternative to making this event composed and we should remove composed now: #11148
(See WHATWG Working Mode: Changes for more details.)
/form-elements.html ( diff )