Build an accordion with details name
Group native details elements with a shared name so an FAQ closes the previous answer when a reader opens another, without a click handler.
Give native details elements the same nonempty name to make an FAQ show one answer at a time. Opening an answer closes the previous one.
Give the FAQ one group name
Each item uses its first summary as the control. The answer follows that summary inside the same details element.
<!doctype html>
<title>Shipping FAQ</title>
<section aria-labelledby="shipping-title">
<h2 id="shipping-title">Shipping FAQ</h2>
<details name="shipping-faq" open>
<summary>When will my order ship?</summary>
<p>Orders ship within two business days.</p>
</details>
<details name="shipping-faq">
<summary>Where is my tracking number?</summary>
<p>Look in the email we send when your order ships.</p>
</details>
<details name="shipping-faq">
<summary>Can I change the address?</summary>
<p>Contact support before your order ships.</p>
</details>
</section>Open the file and select the tracking question. The first answer closes as the tracking answer opens. Activate the tracking question again to leave all three closed.
Use the open attribute on one item if the page needs an initial answer. Omit it from all items if they should all start collapsed. open is a boolean attribute, so open="false" would still request an open item. Use the native summary controls to keep the browser's keyboard behavior. Tab to a question and press Space to test it.
Give independent groups different names
The HTML group rule uses the name in the same tree. The elements can sit under separate wrappers. If you reuse shipping-faq on a separate billing widget on that page, opening a billing answer can close a shipping answer. Give each independent widget its own name.
Remove the name attributes to try the fallback behavior. Browsers without grouping support let readers open multiple answers. If the page asks readers to compare shipping fees with delivery times, leave those items independent so readers can keep both answers on screen.