accname
accname copied to clipboard
WCAG/ACCNAME discrepancy with `<img alt="" title="foo">
From @cookiecrook on July 7, 2017 9:25
The following text in ACCNAME:
"Otherwise, use the value as specified by a host language attribute."
Seems to literally means the value even if it's empty, which does not leave the exception covered by WCAG Success Criteria H67: https://www.w3.org/TR/WCAG20-TECHS/H67.html
For each image that should be ignored: Check that title attribute is either absent or empty. Check that alt attribute is present and empty. ...
Furthermore, both Blink and Gecko allow this behavior. WebKit currently matches the HTML-AAM and ACCNAME specs, but will likely change to match the other browser's behavior. https://webkit.org/b/173870
Test case 7 here: https://bugs.webkit.org/attachment.cgi?id=314203
Copied from original issue: w3c/aria#602
From @cookiecrook on July 7, 2017 9:25
Similar issue in HTML-AAM https://github.com/w3c/html-aam/issues/99
Melanie: This came up in Chromium (which currently doesn't use the title). And it's not 100% clear what the right answer is (use the title or not).
I don't know if the fix belongs here, in HTML-AAM, or what.... But some clarification is needed somewhere. Ideas?
In case it's helpful, there's an img section in HTML-AAM that makes it pretty clear that alt wins:
- If the img element has an aria-label or an aria-labelledby attribute the accessible name is to be calculated using the algorithm defined in Accessible Name and Description: Computation and API Mappings 1.1.
- Otherwise use alt attribute.
- Otherwise use title attribute.
- If none of the above yield a usable text string there is no accessible name.
just spent some time with @stevefaulkner on this, re: the intent of HTML AAM.
from our perspective, if there's an alt="" that would indicate that the image is meant to be "hidden", and therefore the steps would stop at 2. we could clarify that further by revising step 3 specifically indicate it only be applicable if there is no alt attribute.
- webkit treats this scenario as an ignored image (but does label it with the
title) - as already stated, chromium ignores title and the image here.
- firefox does respect the
titleand exposes the image with this as its name.
In case it's helpful, there's an img section in HTML-AAM that makes it pretty clear that
altwins:
I'm afraid in my mind it's not pretty clear. I read that section before commenting here.
- Otherwise use alt attribute.
Would be way more clear IMHO if that statement ended with "even if it's empty."
- If none of the above yield a usable text string there is no accessible name.
Does an empty alt attribute "yield a usable text string"? Without the "even if it's empty" qualifier, that text seems to hint that the goal is a usable text string. :grinning: And we can meet that goal from:
- Otherwise use title attribute.
And WCAG says:
Procedure For each image that should be ignored:
- Check that
titleattribute is either absent or empty.- Check that
altattribute is present and empty.
So for images that should be ignored, there should be an absent or empty title. That, to me, seems to imply that an image which fails to meet both criteria is NOT an "img element for images that AT should ignore." But if an AT should not ignore it, it should have something presentable.
But whatever....
The HTML-AAM's img section is called "Element Accessible Name Computation". So if it's modified to make it clear that alt wins, even if it's empty, that answers the question "What is the name of the image?" Now let's say this same image is being consulted as part of a name-from-contents calculation on an ancestor element.
According to AccName's step 2D:
Otherwise, if the current node's native markup provides an attribute (e.g.
title) or element (e.g. HTMLlabel) that defines a text alternative, return that alternative in the form of a flat string as defined by the host language.
Does the title constitute "an attribute that defines a text alternative"? OR is the assumption that the since the image has no name, the title should also be ignored when calculating name from contents of an ancestor?
this was resolved in HTML AAM.
further conversation in https://github.com/w3c/html-aam/issues/404 and https://github.com/w3c/aria/issues/1746
shall we close this issue in favor of the others where conversation should continue?