Summary must have discernible text
How to Fix the Problem
Correct markup solutions
There are several methods for passing all checks of
summary-name
. The most reliable method for creating an
accessible summary element is to put a text inside the summary element:
<details>
<summary id="text">Name</summary>
...
</details>
Alternative methods
It is also possible to give a summary element a hidden alternative text. This can be used when the summary has no visible text, such as when using a CSS background image. Methods for providing a hidden alternative include:
- Using the
aria-label="text alternative here"
attribute. -
Using the
aria-labelledby="id-to-element-with-text"
attribute. - Using the
title="tooltip alternative here"
attribute.
Why it Matters
Screen reader users are not able to discern the purpose of
summary
elements that do not have an accessible name. This
prevents them from understanding the purpose of the control, and will likely
mean they won't find information hidden with the details
element.
Rule Description
Summary elements are used as a control for expanding and collapsing the
details
element. These summary
elements must have a
discernable text that clearly indicates the topic or purpose of the
information that will be revealed when using the control.
The summary-name
rule separates functionality from the
button-name
rule since summary
elements have
different inherent semantics from button
elements.
The Algorithm (in simple terms)
Checks all summary
elements that are used as a control for a
details
element to ensure that they have a discernable,
accessible name.