开发者

Proper use of ARIA heading role

开发者 https://www.devze.com 2023-02-07 06:31 出处:网络
I wonder if anyone knows if the aria role=heading can be used for non-text elements (such as images) as well?

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 adva开发者_如何学编程nce.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号