It would be helpful to have an option to preserve the open attribute of a details element.
Many cases where a backend doesn't know (or care) if the element is open, but if it isn't preserved the details will close on re-render.
<details>
<summary>Open to see my details</summary>
<ul>
<li>foo</li>
<li>bar</li>
<li>...</li>
</ul>
</details>
Should this be a new option (like openness in modals/disclosure elements) or be done with the existing callbacks?
beforeAttributeUpdated: (e, n, v) => {
if(e.tagName === 'DETAILS' && n === 'open')
return false;
return true;
}
way to implement with existing callback config
This issue was originally opened here https://github.com/yippee-fun/morphlex/issues/41
Decided using the
beforeAttributeUpdatedhook is the best way to express this option. Otherwise weβre going to end up with so many options.