The donate form is done, but the “How Borrowing Works” page is still a long run of headings and paragraphs. Tomasz Nowak only wants to know how long he can keep the step ladder, and he has to scroll past every other answer to find it.
In this lesson, you’ll turn its first two questions into disclosures that show each question and hide its answer until someone opens it. You’ll predict what the browser exposes, style each question from its real open state, and check one with a keyboard and screen reader. Start with the markup HTML already gives you for this.
Turn a Question Into a Disclosure
A disclosure is a control that shows or hides a piece of content. HTML has one built in: the <details> element. Its first child, a <summary>, stays visible and opens or closes everything after it.
Open how-borrowing-works.html from this lesson’s starting site in your live preview. Each question is an <h2> followed by its answer. Replace the first question and its two paragraphs with this:
<details class="faq-item">
<summary>How long can I keep a tool?</summary>
<p>Seven days, counted from the day you pick it up.</p>
<p>If nobody has reserved it, you can renew it once from
My Reservations for another seven days.</p>
</details>
Save, and the page shows the question with a small triangle in front and no answer. Click the question to open the answer and again to close it, with no JavaScript.
To see what a screen reader gets, select the <summary> in the Elements panel and open the Accessibility tab:

In this lesson’s run in Chromium on November 29, 2026, the pane shows the role DisclosureTriangle, which is Chromium’s name for a summary’s role. The name is the summary’s text, and the pane lists Focusable true and Expanded false. Select the <details> around it instead, and its role is group. So when Amara Okafor tabs to the summary with her screen reader, she gets a control named “How long can I keep a tool?”, collapsed.
A screen reader reads that name every time someone reaches the summary, so keep it to the question alone, short and plain. The question is no longer a heading, either. Heading navigation skips it, and Amara reaches it with Tab like any other control.
Before you click the summary, predict: while the answer is hidden, what does the accessibility tree hold for its two paragraphs? To check, turn on Show accessibility tree at the top of the pane. It swaps the Elements tree for the full accessibility tree. Look under the group, then open the question and look again.
While the question is closed, the tree holds only the group and the summary. The paragraphs aren’t there, so a screen reader can’t reach the hidden answer, even line by line.
Open the question, and Expanded turns true, with the two paragraphs right after the summary, so you can read on to reach them.
To practice the wording, open a chat with the AI mentor using the button below. Give it your own FAQ’s questions, and it’ll tell you how each holds up as a summary:
Style the Marker and the Open Question
Open or closed, the question looks almost the same, apart from its tiny black triangle. Kwame wants the open question to stand out in the library’s green, with the answer clearly attached.
The triangle is the summary’s marker. In Chromium and Firefox, a summary is display: list-item, like an <li>, and its marker comes from list-style-type. The summary’s Computed tab shows disclosure-closed, then disclosure-open once the question opens.
Safari draws its triangle another way, so ::marker and list-style don’t affect it. Leave the marker in place to show that the question opens. It takes the summary’s color, so it turns green with it.
Add these rules at the end of styles.css:
.faq-item {
margin-block: var(--space-m);
border: 2px solid var(--color-border);
border-radius: 0.25rem;
}
.faq-item summary {
padding: var(--space-s) var(--space-m);
font-weight: bold;
}
.faq-item[open] summary {
color: var(--color-accent);
border-block-end: 2px solid var(--color-border);
}
The last rule follows the state. Clicking the summary adds the open attribute to the <details>, and closing it removes it, so .faq-item[open] summary matches exactly while the question is open.
You might use a class such as .is-open instead, but nothing changes a class when someone clicks the summary. Without a script, the class stays after they close the question, and the green says it’s still open.
Give the Answer a Panel
Kwame also wants a pale panel behind each answer, and answers hold different things, such as two paragraphs here and a list elsewhere. You’d need a new rule for each kind of element.
The ::details-content pseudo-element selects the box the browser wraps around everything after the summary, whatever it holds. Add these two rules after the others:
.faq-item p {
margin: 0;
padding: var(--space-s) var(--space-m);
}
.faq-item::details-content {
background: var(--color-panel);
}
The first rule spaces the paragraphs, and the second sets the whole answer’s background to the starting stylesheet’s --color-panel value.
What happens when a page has more than one disclosure? Save, then convert the second question the same way, replacing its <h2> and paragraph:
<details class="faq-item">
<summary>What happens if I return a tool late?</summary>
<p>There's no fine. We email you a reminder, and you
can't borrow another tool until it's back.</p>
</details>
Save again, then click the first question, and then the second:

Both questions are green, each with a line above its answer’s pale panel. Opening the second didn’t close the first, because clicking a summary changes only the open attribute of its own <details>. Each question keeps its own state.
::details-content became Baseline Newly available in September 2025, meaning it works in current releases of Chrome, Edge, Firefox, and Safari. To check its status yourself, read the Baseline badge at the top of its MDN page and the Browser compatibility table at the bottom.
An older browser needs no extra code. It drops a rule whose selector it doesn’t understand, so the answer keeps its padding and loses only the panel’s color. That’s why ::details-content gets a rule of its own. In a list such as .faq-item p, .faq-item::details-content, an unknown selector would cause the browser to drop the whole rule.
Check the Question With a Keyboard and Screen Reader
A component isn’t finished until you’ve operated it as its users do. Click each summary to close both questions, then click in the page above the heading so focus starts there. Press Tab, and focus moves to the first question’s summary, with the stylesheet’s focus ring around it. Enter opens the first question, and Space closes it.
Open it once more and select its summary in the Elements panel. Expanded is now true, and the answer’s paragraphs follow the summary in the tree.
For the screen reader, close the first question again and click above the heading. Turn on your screen reader as in the first lesson, and walk through the first question:
- Press Tab to move to its summary, and listen for its role, its name, and its collapsed state.
- Press Space to open it, and listen for the state to change to expanded. In VoiceOver, Ctrl+Option+Space also performs a control’s action, as described in Apple’s VoiceOver User Guide.
- Read on to the answer. In NVDA’s browse mode, Down reads the next line, according to NVDA’s User Guide. In VoiceOver, Ctrl+Option+Right moves to the next item, as Apple’s guide explains. The answer’s first paragraph should come next.
Each screen reader words these parts its own way, so listen for the role, name, and state. If what you heard doesn’t seem to match them, the button below opens a chat with the AI mentor. Tell it your screen reader, your browser, and what you heard at each step, and it’ll help you match each part:
Check Your Understanding
Try these before you open the answers:
- Kwame wants members to see “There’s no fine” without opening anything, so he considers the summary “What happens if I return a tool late? There’s no fine, only an email reminder.” Why is that a poor summary, and where should that sentence go?
- He converts all four questions. Rosa Delgado opens the first question, then the second, then closes the first. Which questions are open?
- The whole summary is the control’s name, so Amara would hear both sentences each time she tabs to it. Keep the question as the summary, and start the answer with “There’s no fine,” the first thing read once it opens.
- Only the second question is open. As your first two questions showed, each
<details>keeps its own open state, so opening or closing one leaves the others alone.
The first two questions now open and close for everyone, and their look always matches their state. Once all four are disclosures, though, Tomasz can open every one and be back to a long page. In the next lesson, Make an Accordion Exclusive, you’ll decide when opening one question should close the others, and make it happen with HTML.