html icon indicating copy to clipboard operation
html copied to clipboard

Allow headings in <summary> elements for <details>

Open yatil opened this issue 3 years ago • 5 comments

Currently, headings in <summary> elements are not allowed and do not show up in the accessibility tree as headings. For accordions and other use cases, using headings inside the <summary> makes a lot of sense. Navigating to a heading inside the summary should set the focus to the summary and then have the expected interaction to open and close the details element.

yatil avatar Feb 07 '23 10:02 yatil

@whatwg/a11y are there any issues with AT with allowing headings in summary?

zcorpan avatar Feb 13 '23 15:02 zcorpan

I think the issue is that summary is exposed as a button in the a11y tree, and buttons can only have plain text. So long as that is the case we can't allow headings (same as with button element).

zcorpan avatar Feb 13 '23 15:02 zcorpan

headings are presently allowed, but per the way this has been implemented they don't always get exposed. this is related to https://github.com/whatwg/html/issues/2272

scottaohara avatar Feb 13 '23 17:02 scottaohara

FYI it's more of an AT issue with more appropriate role for this use case missing, see the discussions around this topic in general: https://github.com/w3c/aria/issues/939#issuecomment-1656739513

janbrasna avatar Jul 22 '24 15:07 janbrasna

Headings in <summary> have been allowed for about a decade at least. That is they have been valid for as log as the Internet Archive's Wayback Machine reaches back for the currently relevant spec page: https://web.archive.org/web/20141013114912/https://html.spec.whatwg.org/multipage/forms.html#the-summary-element

prlbr avatar Aug 15 '24 15:08 prlbr