Skip to content

Accordions Should Auto-wrap contents #176

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

Open
bd-viget opened this issue May 6, 2025 · 0 comments
Open

Accordions Should Auto-wrap contents #176

bd-viget opened this issue May 6, 2025 · 0 comments

Comments

@bd-viget
Copy link
Contributor

bd-viget commented May 6, 2025

Summary

This issue is related to animating the Core Details block.

If we attempt to add a smooth open/close animation to the content of the Details block, the targeted elements can be unclear. To accommodate for the dynamic content, we should always wrap the content in a group block (using the render_block filter) whenever there is more than 1 sibling element in the content, then target the nextSibling of the summary element.

Examples

Only 1 Sibling: No Wrap Necessary

<details class="wp-block-details">
    <summary>Lorem ipsum dolor sit amet, consectetur adipiscing elit</summary>
    <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</details>

Only 1 Sibling: No Wrap Necessary

<details class="wp-block-details">
    <summary>Lorem ipsum dolor sit amet, consectetur adipiscing elit</summary>
    <div class="wp-block-group">
        <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
        <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium</p>
    </div>
</details>

2 Siblings: Needs Group Wrapper

<details class="wp-block-details"
    <summary>Lorem ipsum dolor sit amet, consectetur adipiscing elit</summary>
    <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium</p>
</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant