Closed scottaohara closed 2 years ago
I think I am a fan of forbidding aria-label, but I would want to make sure aria-labelledby works because there are cases in which organizations most-certainly do wish to visually surface alt text. I have several such projects and am encouraging more, for true inclusion around visual description practices within the cultural sector. Doubling that info in the alt makes for a noisy interface. Yes, aria-hidden on various elements and other workarounds can be used, but if they didn't need to be, that would make things much easier.
I know it is a bit off topic, but one of the most irritating things is how figure is handled. I currently have to hear the entire caption as the accessible name of a figure, then the alt text, then the entire caption again as the AT informs me the about the end of the figure. It is beyond aggravating, and I would want to prevent any such doubling up here, which is why I think I'm a fan of forbidding aria-label, though it does bother me a bit from a purely technical perspective. I know those are totally different use cases, but just something to keep in mind.
Lots to think about.
thank you @sinabahram
should image rules be updated to be based on whether the img has an accessible name, rather than if an alt is used or not.
But this is already stated in the specification at present:
Otherwise, if the img has an author defined accessible name, see img with alt="some text".
should we not recommend aria-label be used on an image at all? i don't really understand the use case as to why someone would use aria-label over an alt, or even use both together as per my above point, but even possibly more troubling if the values are different.
I would not ban things as seeming useless, but only things that can lead to problems with output by AT. I see no problem with aria-label am img.
I also don't see why alt and aria-label causes problems:
But this is already stated in the specification at present:
it is, but it could stand to be clearer since the rules are contingent on the img
having an alt
, and not explicitly about whether it has accessible name at all. so right now conformance checkers would not be incorrect to state that <img src=... alt="" aria-label=foo role=button>
is an error, because the alt=""
rule states that there should be no role or aria-
attributes set.
I would not ban things as seeming useless,
I didn't say ban. I said not recommend. Regarding problems:
aria-label="some text"
and alt=""
on an image. What was the author's intent? Was the image meant to be decorative alt=""
or is it supposed to be informative aria-label
? Did one author do this, or two? What's another author to think looking at this image?img
is unique to most other HTML elements because an alt
is its expected naming mechanism and an img
is flagged as being invalid without the attribute. so if authors have to use alt
to have valid html, then what's a good reason for them to also use aria-label
? Sina's example of using aria-labelledby
is an interesting use case, but I still fail to see a good reason as to why an author would choose aria-label
over alt
. The aria-label
attribute would likely still have issues with translation services, it wouldn't produce fallback text if the image failed to render, and again, confusing intent if also used with alt=""
.Closing this issue in favor of https://github.com/w3c/html-aria/issues/424
revisions to consider after 1.0:
alt
is used or not. valid html dictates that analt
is needed, but if an image hasalt=''
andaria-label=foo
, then the image will be exposed rather than hidden.aria-label
over analt
, or even use both together as per my above point, but even possibly more troubling if the values are different.