validator
validator copied to clipboard
No errors or warnings found for heading descendants of ARIA buttons
Spec URL
https://w3c.github.io/html-aria/#index-aria-button
Test case
<div role="button">
<h1>Lorem ipsum</h1>
</div>
<div role="button">
<h2>Dolor sit</h2>
</div>
<div role="button">
<h3>Amet consectetur</h3>
</div>
<div role="button">
<h4>Adipiscing elit</h4>
</div>
<div role="button">
<h5>Sed do</h5>
</div>
<div role="button">
<h6>Eiusmod tempor</h6>
</div>
<div role="button">
<div role="heading" aria-level="1">Incididunt ut</div>
</div>
All of the examples are valid markup. As the linked html-aria spec states, a div with a button role may contain flow content such as headings.
I could see an argument for a warning for roles with "children presentational" but it's complicated - see for example https://github.com/w3c/aria/issues/2509.
Oh! I confused the two columns in the spec - sorry for the confusion.