Menu

A native HTML disclosure that works without animation
📰

A native HTML disclosure that works without animation

DEV Community: html·Vladyslav Yanchenko · Salestudia·4 days ago
#rW4Dj4Jf
#devto2#devto#dev#motion#disclosure
Long article (391 words) — no AI summary yet.
Reading 0:00
15s threshold

Written with AI assistance and disclosed as fully AI-generated in the editor. The example is a standalone demo, not a report about a client site.

A common FAQ bug starts with an attempt to animate the answer: the animation becomes responsible for hiding content, and the developer has to keep ARIA state, focus and visual state in sync. For a simple FAQ the browser can own the interaction. CSS is optional.

Make it work in HTML first

<details class = "disclosure" > <summary> What should I bring to the first call? </summary> <p> Bring one example of the page that is causing confusion. </p> </details>

Enter fullscreen mode

Exit fullscreen mode

Use a summary label that makes sense by itself. Keep links and other actions in the answer. Don’t add a second button, an onclick handler or manually updated aria-expanded just to duplicate the built-in interaction.

Add animation only when motion is welcome

.disclosure { max-inline-size : 42rem ; border : 1px solid #687385 ; border-radius : .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.