Precise DOM morphing
morphing typescript dom

Preserve open attribute on details disclosure elements #1

closed opened by joel.drapper.me

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 beforeAttributeUpdated hook is the best way to express this option. Otherwise we’re going to end up with so many options.

sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:uqrryaveb7djvaatfljbdhcb/sh.tangled.repo.issue/3mgdhpng5lt22