Repository navigation
Description
ARIA in HTML is updating to clarify the ARIA attribute allowances for the summary element:
- Correction: conditionally revise allowed attributes and roles on summary element w3c/html-aria#435
- preview spec change: summary element allowances
The summary currently allows no role, and any global aria-* attributes, and any aria-* attributes applicable to the button role.
The update changes this to indicate that no role is allowed so long as the summary element serves as the summary for its parent details element. However, Any role will be allowed on the element if it does not meet this requirement.
For instance, the following would continue to disallow any role from developers, as applying roles can cause AT to no longer correctly expose the current state of the disclosure widget:
<details>
<summary>no role allowed</summary>
...
</details>
But the following examples demonstrate where any role may be applied to the summary element, as it does not meet HTML's conditions to be considered the summary for its parent details.
<details>
<summary>
no role allowed on this summary, as it is the first instance of the summary
element within the details element, and thus browsers treat this as the
summary / trigger to open/close the disclosure widget.
</summary>
<summary role=paragraph>
any role is allowed on this summary element because it is ignored as a summary
element by browsers, and instead returned as a generic element.
</summary>
</details>
<summary role=group>
this summary element also allows any role because it is not a child to a
details element, and thus is exposed as a generic by browsers.
</summary>
As the summary element is not consistently exposed as a button by all browsers, AND not all of the allowed ARIA attributes for button element even work on this element, the allowed attributes have been modified to reflect this.
If the summary element acts as the summary for its parent details, then global aria attributes and the aria-haspopup and aria-disabled attribute may be specified. Note that aria-expanded and aria-pressed are the attributes no longer allowed, and per testing, these attributes were not respected anyway.
If the summary element is not the summary for its parent details, then any global aria attributes and any attribute applicable to the allowed specified role may be used.
Additional examples and test cases can be viewed here:
Activity
straker commentedon Feb 13, 2023
Thanks for the update. This one may be hard to do with our current architecture. What roles/attributes are allowed on HTML elements is handled by our htlm-elms code. The code has the ability to change which roles/attributes are allowed based on attributes or properties of the node (using the
variantproperty), but that only can work for checking things about the node itself. We currently do not have the ability to check for how the element is used (parent, structure, etc.). As a note, we also have the same problem for the figure element, so may have to make the same exception here (that is, allow any role to bypass the failure of using a role outside ofdetails).scottaohara commentedon Feb 13, 2023
might this current limitation also relate to #3439
and future updates we were planning to clarify the allowances for table element roles (similar to this li rule. if the table is no longer a table, then any role is allowed on the child elements (so long as they also then meet the requirements for their use)
straker commentedon Feb 13, 2023
Yep, that one also would fall under this limitation. Looks like we'll have to figure out a way to handle this moving forward.
straker commentedon Jul 21, 2026
The idea we have is to add more matching functions to our
libs/commons/matchesthat can implement the check to see how the element is used. Similar to the functions needed in ourlib/commons/standards/implicit-html-roles. Then we can trigger the matches functions from thehtml-elmsvariants.fix(aria-allowed-role): allow roles on a non-details summary
feat(matches): add inSectioningContent, hasChild, and isSummaryForDet…
fix(aria-allowed-role): allow roles on a non-details summary (dequela…
chore(release): v4.13.0 (#5288)