phillyville
phillyville

Reputation: 355

Proper use of ARIA heading role

I wonder if anyone knows if the aria role=heading can be used for non-text elements (such as images) as well?

For example:

<img alt="..." role="heading" aria-level="1">

Thanks in advance.

Upvotes: 3

Views: 2890

Answers (1)

BrendanMcK
BrendanMcK

Reputation: 14498

Why not just use...

<h1><img alt="..."></h1>

...instead? This would seem to have the same functionality, but avoids the issue of whether ARIA is even supported.

This would also be search-engine (SEO) friendly, in that a web crawler will know that the contents of the is being used as a heading and will treat it accordingly, while it is very unlikely to look at the aria attributes.

Upvotes: 4

Related Questions