-
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
<details> 'toggle' simple event bubbling #1533
Comments
Does it in implementations? |
I've only tested in stable Firefox and Chrome. In Firefox 47 the details element needs to be enabled in |
The specification is quite clear in that it shouldn't bubble. However, if it's more useful for developers if it does, perhaps we should reconsider. @aethanyc @tkent-google thoughts? |
Yep, it certainly is, and it's not at all surprising to me that Chrome implemented it to-spec. As a developer, I do think it would make sense and be more useful for this event to bubble so delegated event handlers can be used. There are ways around this in lieu of this event not bubbling, but it would make much more sense to me if the event bubbled. |
Firefox implemented the toggle events in Bug 1225412 which is in Firefox 48. Firefox certainly does follow the spec, but I see no reason that the toggle event cannot bubble. And it should be trivial to implement the bubbling. @smaug---- any concerns? |
Well, if you have nested And if one needs to listen for toggle at higher level, use capturing listeners. |
Fair, I'm going to close this then. It can be reopened if WebKit/Chromium are comfortable changing their behavior, which seems unlikely. |
The point about nested details is a good one, and fatal to the idea of bubbling IMO. Thanks @smaug---- for catching that. |
To play devil's advocate, wouldn't that argument be equally valid with respect to bubbling "click"? The Event interface has |
If you click on something inside something else, it's arguable that you clicked on the outer thing too. (I.e., not only did I click on the button, I also clicked on the document; both are true, and both objects should be notified of the click.) Whereas if you toggle a details inside another details, you definitely didn't toggle the outer details. |
What about "dragstart"/"dragend" (since I didn't start/stop dragging the ancestor) or "submit" (since it's forms that get submitted, not their ancestors)? Bubbling can be very useful, and should not be discarded so lightly. |
Forms cannot be nested. I'm not sure about the drag event handlers; maybe they should not bubble either, but presumably IE8 or whatever made them bubble and everyone else followed them, so no need to change that now. |
I have a long list of <repository-list>
<details><summary>Repository A</summary></details>
<details><summary>Repository B</summary></details>
<details><summary>Repository C</summary></details>
<details><summary>Repository D</summary></details>
<details><summary>Repository E</summary></details>
<details><summary>Repository F</summary></details>
<details><summary>Repository G</summary></details>
...etc
</repository-list> I want to lazy-load the repository data on The argument about nested |
Can't you add capturing event listener on repository-list? |
I can listen for |
Use capturing, not bubbling. |
tsk, i forgot about capture mode.. thanks guys 👍 |
Currently, the spec states that whenever the
open
attribute is changed on the<details>
element, a simple event namedtoggle
will be fired on it.https://html.spec.whatwg.org/multipage/forms.html#the-details-element:fire-a-simple-event
I couldn't find anywhere that stated the
toggle
event should bubble, but it would make sense (to me) that this event should bubble.The text was updated successfully, but these errors were encountered: