The Balai’s FAQ from your own <details>: try a click, Enter and Space, give several drawers the same name, and see what the browser does; every toggle event…
Why it matters
FAQs, settings panels, side menus: disclosures are everywhere. <details> comes with clicks, Enter and Space for free, reads to a screen reader as a button that is open or closed, and keeps its content in the DOM. The name attribute removes one classic JS pattern: the accordion where only one may be open.
The key idea
The name attribute makes an exclusive accordion without JS
Common mistakes
Building an exclusive accordion with JS No need any more: give the <details> of one group the same name. The browser closes the rest. A different name value = a different group.
The default triangle marker is hard to customise Hide it with summary { list-style: none } plus summary::-webkit-details-marker { display: none } (Safari), then draw your own with summary::before and details[open] > summary::before.
Worried closed <details> content is not indexed Its content stays in the DOM (the scene counts the characters), just not rendered. Search engines read it, and Ctrl+F in Chrome opens the drawer holding the word you look for.
Try it in this playground
Open one item, then another in the same group The first closes by itself. The log says who did it: the browser, because of one group name="faq".
Remove every name, then open them all With no group each item is free: all three can be open together.
Tab to a heading, press Enter or Space<summary> already takes focus and works from the keyboard, with no tabindex or handler.
Write open on one <details> That item is open as soon as the markup loads. The initial state lives in the HTML, not in JS.