html
html copied to clipboard
details element toggle event should bubble
https://html.spec.whatwg.org/multipage/interactive-elements.html#the-details-element
Whenever the
openattribute is added to or removed from adetailselement, the user agent must queue an element task on the DOM manipulation task source given thendetailselement that runs the following steps, which are known as the details notification task steps, for thisdetailselement:
- …
Fire an event named
toggleat thedetailselement.
Because that does not include "with the bubbles attribute initialized to true", the event does not bubble. And because it does not bubble, there is no convenient way to detect when a descendant details element is opened or closed (even though it is possible with general DOM mutation observation). In addition to making certain patterns unnecessarily difficult, this behavior diverges from similar events such as changing an input, select, or textarea element or its selection, resetting or submitting a form, and even clicking any element.
there is no convenient way to detect when a descendant
detailselement is opened or closed
Use capturing event listener?
That works, but also fails the convenience criterion in many cases because the outside-in traversal order is backwards from defaults (and again, is not necessary for other similar events).
@domenic @annevk Is this a wontfix given https://github.com/whatwg/html/issues/8888 ?