Re: Adaptive Image Element Proposal

Mathew Marquis, Wed, 29 Aug 2012 11:29:40 -0400:

A look at what the draft says on accessibiltiy.[1]

For accessibility, it suggests placing an alt attribute on the very 
root element - the picture element. And it suggests that the picture 
element should be treated like the img element when it comes to 
providing accessibility. Though it does not (yet) say it (please do say 
it!), I suppose that an empty alt attribute is supposed to mean that 
the image is presentational. Thus, a full "copy" of the img element, 
with regard to accessibility and - I suppose - with regard to its ARIA 
role (I suppose it is going to have role img, right?).

However, for fallback, it suggests using the img element as a child in 
the fallback. And that the img element SHOULD then duplicate the alt of 
the picture element:

]] In order to fall back gracefully, the alt attribute and its
   value should be repeated on the child img element. [[

3 comments regarding img as child of picture

(1) To repeat oneself is an antipattern. In my view, it should be 
considered valid if the <img> does not contain any @alt as long as it 
instead points, via aria-labelledby="", to the picture element:

<picture alt="Alernative text" id="pict" >
 <img src=file aria-labelledby="pict" />

(2) Also, if the picture element is the content of an figure element 
with a figcaption, then the img should not need to contain the alt 
attribute. (This may not need to be said - perhaps HTML5 already cover 

(3) If the picture is presentational (has empty alt), then the img, if 
any, would need to have empty alt as well.

But other than that, then I think an <img> as child of <picture> needs 
to be conformance checked/authors as if the <picture> element did not 

In bug 18384 [2], we discuss other ways to provide fallback. Perhaps 
those methods should be reserved to situations when picture is given, 
by the author, another role than "img" or "presentation" - e.g. if it 
has 'document' role. Thus, it may be necessary to specify further rules 
about the fallback so that the fallback is not used in ways which are 
inconsistent with its role as alternative text. 

If you like them, then hope these ideas get reflected in the draft. 

leif halvard silli

Received on Thursday, 30 August 2012 12:54:13 UTC