Open 36degrees opened 1 year ago
Here's a bit of investigation work I did into the theoretical and fundamental question of: can heading elements be used within table caption elements?
there doesn’t appear to be any specification-level issue with having a heading <h*>
element inside of a <caption>
.
I think we’d want to test it with screen readers though, just to be sure screen readers are interpreting headings within captions as just regular ol’ headings.
It’s probably best to check this stuff before making a decision on allowing headings inside captions:
After that, here's some questions we may want to add to our guidance, for teams whenever using headings inside captions across varying services:
Here's some things it’s probably best to disallow (likely via guidance) if a heading is inside a caption:
Places I checked for evidence for or against heading elements inside of caption elements:
What
Investigate whether allowing headings within table captions may make it easier for users to understand the hierarchy of information on a page or to navigate the page.
Why
Captions are styled similarly to headings, but are not headings so do not show up in headings lists and are not included when navigating using headings in screen readers.
The content model for the
caption
element allows for any flow content, which includes headings, so it's a valid thing to do according to the HTML spec.Assumptions
Including a heading within the caption does not affect the role of either the caption or the heading, nor how they are communicated to users of assistive technologies.
Timebox
TBC
Who is working on this?
Spike lead: TBC
Spike buddy: TBC
Questions to answer
Done when