w3c / html-aria

ARIA in HTML
https://w3c.github.io/html-aria/
Other
179 stars 48 forks source link

Should <img> support role=figure? #319

Closed cyns closed 3 years ago

cyns commented 3 years ago

The definition of figure is one or more images, but images can be quite complex internally. One use case would be SVG images with sub-parts and text inside. Figure is a kind of image.

stevefaulkner commented 3 years ago

Hi @cyns welcome back!

The definition of figure is one or more images

this is not correct, the definition of figure in ARIA is:

A perceivable section of content that typically contains a graphical document, images, code snippets, or example text...

in HTML

The figure element represents some flow content, optionally with a caption...

scottaohara commented 3 years ago

I spent some time kicking this idea around and the results were not particularly good.

tldr; aside for a few instances, placing a role=figure on an <img> caused the image to become completely hidden from screen readers.

Regarding the complex SVG scenario, even if role=figure on an image had better support, this wouldn't be a viable use case as screen readers can't enter the SVG's DOM when its a source of an <img> element. However, this can work just fine for an actual <svg>, and that element does allow any role.

Per the above, I'm going to close this issue as I don't want to allow something that'd make the content inaccessible.