Open glendaviesnz opened 2 years ago
Also, if an image is linked there is no semantic association between the link and image.
To clarify: There is a semantic association; a linked image is the accessible name for the link. The problem here is that if an image is linked, and has no alt attribute, then the link has no name. If an image has a caption, but no alt attribute, we can name the link by associating the caption with the link. If we're not going to implement a mechanism to enforce alt attributes on linked images, then this is the closest we can get to solving that accessibility issue.
A simpler way would be to add the caption to the alt attribute if the alt is empty, but if you think it should use aria-describedby
, I'll give that a go.
Semantically, it's more accurate to make the relationship between two things more consistent; and won't require as much duplication of code. I'd still go with the aria-describedby
option.
What problem does this address?
Currently if the Image does not have an alt tag, but does have a caption there is no semantic link between the image and caption in order for screen readers, etc. to make use of it.
Also, if an image is linked there is no semantic association between the link and image.
What is your proposed solution?
Use an aria-describedby to point to the existing caption if there is a caption. If there is no labeling information at all, we should not insert any; we just need to ensure that if there is labeling information available, it should be associated with the image, or the link if the image is linked.