You can't actually control the open state properly from markup (the `open` attribute only sets the default state), which is why I haven't bothered with them.
If you specify the same name on each `details` element they behave like an accordion automatically [1], no need for JavaScript. If you set one of them to open that one will be initially open.
[1] https://developer.mozilla.org/en-US/blog/html-details-exclus...
Out of curiosity, why have you needed to? This has never come up for me.
I’m not sure this is correct. The DOM class HTMLDetailsElement has the `open` property, which you can use to read/write the details element’s state. If you’re using setAttribute/getAttribute just switch to the property.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLDetails...