-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
image with alt text using aria-label incorrectly throws error #157
Comments
I don't think this is a bug, for pretty much the same reasons as #156 (comment) In short, aria-label is seen as an alternative for title, not for alt. You still need a suitable text description of the image, either in an alt attribute or in body text (with alt=""). |
This one is a little tricky, I was able to dig up some text in WCAG documentation that supports being able to use aria-label or aria-labelledby in lieu of alternate text for images. The Accessible Name and Description Calculation describes the order of checks:
I'd interpret this as aria-label being a valid alternative to alt for displaying an accessible name for accessibility APIs. Note: If you dig into the usage of aria-label and alt the purpose differs (as Luke mentions above) so it would be up to the author to understand those differences and populate the content of the attribute accordingly. |
Why must the text be visible on the page when used for |
Good question. It's less about images and more about the intent of aria-labelledby. As it is intended, aria-labelledby is for use when the desired label is visible elsewhere on the page. The ARIA 1.1 documentation does not explicitly state that aria-labelledby should not be used when the label is not visible; however, this is strongly implied:
This is further reinforced by the ARIA 10 Sufficiency Technique of WCAG 2.0 (Using aria-labelledby to provide a text alternative):
For images, an instance where aria-labelledby would make sense would be when a visible caption is present and its nature is such that providing a non-visible alt text description would be redundant. In most instances, an author would want to use aria-label for images or simply supply alt text, as having a visible image description is not desired. Interestingly, it is possible by design to use hidden text for aria-labelledby and aria-describedby (Accessible Name and Description: Computation), but this does not really fit the intent of the aria-labelledby property. |
An image that is given alternate text using
aria-label
is incorrectly flagged as an error. This is the code that threw the error:The error given is:
The text was updated successfully, but these errors were encountered: