Re: Default role of <IMG> should be "img"

Steven Faulkner, Mon, 13 Sep 2010 11:04:47 +0100:

>> "Better questions for getting screen reader user views on UI images 
>> might be:..."
>  
> yes many better questions could be asked, but I am fairly certain the 
> screen reader users who responded (included a screen reader 
> developer, yahoo accessibility evangelist, a developer working on 
> drupal accessibility),  understood the intent of the question.

One of them said "unless it's a spacer or other * purely * stylistic 
image". I don't know was meant by "stylistic image". But I would think 
that an image that only represents text in a certain font, would fall 
into that category.
  
>> "<button><img alt="Edit" src="pencil.png"></button>"
>> "because the button text would be represented as just button text in 
>> the accessibility tree rather than as an image with a text 
>> alternative?"
>  
> NO I would argue for the current behaviour:
> The accessible tree (can be viewed using firefox DOM inspector) looks 
> like this:
>  
> - pushbutton > name > bottle
> -- graphic > name > bottle
> When an AT such as JAWS encounters the button announces the button 
> role and its accessble name value (from the image alt text) it does 
> not announce the image. BUT the image is not removed by the browser 
> from the accessible tree.

I don't think this is perfect answer: The author could provide the text 
inside an visually hidden adjacent <span> element and give the <img> 
role="presentation" via alt=<emptystring>. Voila. The benefit of the 
not-removed image would then be gone, since the image would in fact be 
removed.

It is also backwards that one can set an image *with* empty alt to 
role="img" - without getting a error. Wheras role="presentation" is 
suitable as "validation godsend", as long as we are dealing with <img> 
... [1]

It is nice, when it works, that the image role isn't announced. But who 
knows how the AT works? E.g. you said that <a><img alt=foo></a> is 
typically announced as "link graphic foo", but that "link foo" would 
usually be better. [2] (As a matter of fact, VoiceOver does what you 
suggest!)

Meanwhile, ARIA says that role="presentation": [3] ]] does not cause 
the content contained within the element to be removed from the 
accessible tree [[. 

So isn't the @alt text "content"? Yes it is. It is just as much content 
as the graphic itself. So it shouldn't be removed. After all: the 
reason alt="<empty>" causes role="presentatioN" is because the @alt is 
so significant w.r.t. to what the IMG represents! Bug 10614.

But, regardless, if the intention is that role="presentation" hides the 
image, are the other workarounds? Yes,  this works (but the @alt text 
shoudl, according to Richard [1], be flagged an error):

<button role="button" aria-labelledby="pencil" >
    <img id="pencil" role="presentation" alt="Edit" src="pencil.png">
</button>

[1] http://lists.w3.org/Archives/Public/wai-xtech/2010Aug/0073
[2] http://lists.w3.org/Archives/Public/wai-xtech/2010Aug/0014
[3] http://www.w3.org/WAI.new/PF/aria/complete#presentation
[4] http://www.w3.org/Bugs/Public/show_bug.cgi?id=10614
-- 
leif halvard silli

Received on Monday, 13 September 2010 10:59:47 UTC