[whatwg] Adaptive Image Element Proposal

Kornel Lesiński kornel at geekhood.net
Wed Sep 5 14:29:22 PDT 2012


On Tue, 04 Sep 2012 22:53:57 +0100, Leif Halvard Silli  
<xn--mlform-iua at målform.no> wrote:

>>> If we say that <picture> should have img role, then we imply that
>>> alternative text should be provided via an attribute.
>>
>> Why?
>
> Because that is what ARIA 1.0 says about the img role: "In order for
> elements with a role of img be perceivable, authors
> SHOULD provide alternative text or a label determined by the accessible
> name calculation."

The "accessible name calculation" algorithm includes a clause:

> Otherwise, if the attributes checked in rules A and B didn't provide  
> results, text is collected from descendant content if the current  
> element's role allows "Name From: contents."

so if I understand this correctly, the <picture> element can be defined to  
allow "Name From: contents", and then it will work fine as role="img" and  
structured alternative content in the element.

> You mean, treat <img>’s @alt like the <caption> of <table>, for
> instance? That is: Make it <img> a required part of the <picture>
> construct, for instance? I do think that integrating <img> into
> <picture> as a part of the picture compound element, sounds
> interesting. And it could be possible, I guess.

Not exactly required. Simply read alternative content from element's  
content. If you find <img> there, then read its alt. If you find text,  
table or something else, then read that.

> One thing to think about is this: If we e.g. have a <table> which we
> declare as presentational, then we also, per the ARIA rules, declare
> the elements that are part of the <table> construct of that particular
> table (<td>, <tr> etc) as presentational. So, if <img> was seen as part
> of <picture>, then, to declare <picture> as presentational would also
> affect the <img>.

Yes, I think it makes sense.

<picture role=presentation></picture> would be equivalent to <img alt="">  
(presentational image).

<picture --role=img--></picture> would be equivalent to <img> (missing  
alt).

<picture --role=img-->alternative</picture> would be equivalent to <img  
alt="alternative"> (alternative present).

-- 
regards, Kornel



More information about the whatwg mailing list