-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Use ToggleEvent for <details> element toggle event #8893
Conversation
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.
Normative text LGTM, just some editorial nits (which I'm happy to take care of before merging).
Should we move https://html.spec.whatwg.org/#the-toggleevent-interface somewhere more shared? No obvious candidates to me, but maybe https://html.spec.whatwg.org/#activation ? Thoughts appreciated.
Thanks for putting this PR up! |
e628022
to
752b8d1
Compare
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.
Thanks for the work here! I found a few nits, several of which I see are also worth fixing for the popover text.
We also need to resolve #8893 (review) , i.e. move the ToggleEvent definition to a shared location.
Additionally, https://html.spec.whatwg.org/#the-toggleevent-interface has some popover-specific stuff. I think we can just remove most of it, and end up with
The
oldState
andnewState
attributes must return the values they are initialized to.
Question: When the The existing spec text for |
Assuming we should be using the “user interaction task source” for both the Or even if the two cases used a different task source, we could still have s shared “Queue a toggle event task” algorithm but just with the task source as an additional input parameter to the algorithm. But of course it’s simpler if we can just make the same task source be used in both cases. |
Yeah, I noticed this divergence. As part of this change let's get implementers to sign off on aligning the task sources used. In practice task sources are very hard to observe so this should be fine. Actually it looks like both Chromium and WebKit already use DOM manipulation for popover. So this is just a fix where the current spec is bad: And I think using DOM manipulation is best anyway, since the flow is generally |
OK, I’ve pushed a change that moves both |
This is great! However, the unification has revealed a bit of a collision. The popover section defines that every element has a toggle task tracker. And the details section defines that each details element has a toggle task tracker. Are they supposed to be the same, or separate? What is everyone implementing? If they are supposed to be the same, then:
If they are supposed to be different, then:
|
196bd83
to
a7a5b67
Compare
aha yeah
I haven’t looked at the Blink implementation, but in the WebKit implementation, they are separate.
I think that’s what we have now — minus my 196bd83 commit (which I’ve now backed out).
That seems like the most practical option. And I think that’s what the current state of this PR branch now has. They’re relatively short and simple algorithms, so keeping them in sync shouldn’t be that difficult. |
OK — the algorithm for |
I'm OK either way, but yeah, a separate PR is probably a bit cleaner. |
a7a5b67
to
47ac7d1
Compare
OK, I’ve pushed an update that defines “details toggle task tracker” and “popover toggle task tracker” as each being a separate “toggle task tracker”. |
OK, I’ve opened opened #9630 for that |
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.
LGTM. It would be ideal if we could get tests for <details popover>
behaviors, although I don't have any specific suggestions, and I don't think it blocks merging this.
Thank you @sideshowbarker & @domenic for putting this across the finish line! \o/ |
There is this test, but it doesn't currently test events. It could fairly easily be updated to do so, however. |
This matches the toggle events fired for popovers. This was specced here: whatwg/html#8893 Fixed: 1416738 Change-Id: Icdaaa8a39093f6986626259a04e5968f3554c820 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4874536 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1202609}
(See WHATWG Working Mode: Changes for more details.)
/index.html ( diff )
/indices.html ( diff )
/interaction.html ( diff )
/interactive-elements.html ( diff )
/popover.html ( diff )