Proposal: accessibility revision for the img element...

A long discussion has raged on these, and it turns out that some  
interesting principles are touched on. In a seperate mail I will discuss  
the issues and principles...

But first, a concrete proposal for the img element and the accessibility  
features it should have:

1. The alt attribute replaces the image if for some reason it is not  
rendered. User agents must make its content available (whether by tooltip,  
context menu option, or otherwise) to users, and where an image is not  
rendered should render the entire text in place of the image.

In cases where rendering additional text in place of an image would be  
redundant, authors should use a null value: alt="". In general, alt should  
not use values such as alt="image of Something" or alt="company XYZ logo"  
- instead this ind of contextual information *may* be provided via the  
title attribute. In the former example, it may make sense to say alt="The  
rare northern hairy-nosed wombat". In the latter case it may make sense to  
use alt="Company XYZ". In either example, the surrounding text may render  
further content in the alt attribute redundant, in which case it should  
have a null value: alt="".

More guidance on good use of the alt attribute is available from many  
expert groups...

2. The longdesc attribute provides a link to a description of the image.  
This may be either another part of the same page, or a seperate document.  
User agents must provide a means of discovering that a longdesc link is  
available, and of following it - for example by making the image  
focusable, and providing a context menu option to follow the relevant link.

Where the longdesc points to a fragment of a page, it should point to an  
element that is a container for the entire description. If the pointer is  
to an entire page, that entire page should be a description of the image.  
This will allow user agents to more reliably provide various alternative  
renderings of the description according to user preferences.

The longdesc attribute should be used where a description of the image is  
important. This might include complex graphs, photographs in a collection,  
or objects that the author would like a user to recognise, such as a  
corporate logo or a navigational landmark. In many cases where an image  
has alt="" it will still be relevant to use a longdesc attribute.

Describing an image is more of an art than a science, and depends in large  
part on why the image was included in the first place - the same image may  
have different uses in different pages. However, providing enough  
information to identify the image is somebody knows it is helpful, as well  
as describing particular features of the image. Some short example  
descriptions:

"The Mona Lisa as a cow: A cartoon based on Leonardo Da Vinci's 'La  
gioconda' or 'Mona Lisa'. The smiling face that is the subject of the  
original is, instead of being a young woman, a cartoon cow, as if sitting  
up for a head-and-shoulders portrait, seen from a 45 degree angle."

"Ships in the sky: this is actually a photo taken from a mobile phone with  
a very dirty lens in the rain. Somehow the effect is to make it look like  
ships in a stormy sea which is somehow strewn with clouds, although close  
inspection reveals that a wet road reflects both the blurry cars and the  
clouds."

"My lunch: Peeled boiled chunks of potato, meatballs about the same size,  
and frozen diced carrot and peas, all covered in some kind of brown sauce."

Naturally, it is possible, and in many cases desirable, to have a fuller  
description available.

3. The [title attribute], as with other elements, may be used to provide  
contextual or advisory information.

What this means compared to the current spec:

The relevant section from what says it is an Editor's draft of 23 June, at  
http://dev.w3.org/cvsweb/~checkout~/html5/spec/Overview.html#the-img, has  
the following:

[[[
The img element represents a piece of text with an alternate graphical  
representation. The text is given by the alt attribute, which must be  
present, and the URI to the graphical representation of that text is given  
in the src attribute, which must also be present.

The image given by the src attribute is the embedded content, and the  
value of the alt attribute is the img element's fallback content.

When the alt attribute's value is the empty string, the image supplements  
the surrounding content. In such cases, the image could be omitted without  
affecting the meaning of the document.

If the alt attribute is omitted, user agents must treat the element as if  
it had an alt attribute set to the empty string.

The alt attribute does not represent advisory information. User agents  
must not present the contents of the alt attribute in the same way as  
content of the title attribute.
]]]

As a minimalist approach, I would change the first paragraph to read as  
follows:

"The img element represents an image. The alt attribute, which is  
required, provides fallback text content to be used in place of the image.  
A description of the image may be made available to the user via the  
longdesc attribute, for enhanced accessibility."

I would append to the second paragraph the following:

"Where the image cannot be displayed, the user agent should present the  
text content of the alt attribute in its place. The entire content of the  
attribute should be available."

Note that this introduces a non-trivial problem. In some cases, the layout  
of the page will become very complicated if the entire text is presented  
to the user visually at normal reading size. In other case, however, the  
user will not get the normal layout of the page anyway, so this is not a  
concern. For this reason, browsers should be free to determine exactly how  
the text is made available.

I would remove the third paragraph entirely. In practice, user agents do  
not do this, since some attempt to provide some useful information to  
users in the absence of both the image and an alt attibute, and since this  
is recommended for accesssibility purposes. In addition, it encourages the  
omission of the alt attribute rather than using a null value, despite the  
requirement for the attribute expressed in the first paragraph. This is,  
in my opinion and experience, worse than the incidental encouragement to  
include meaningless or default values for alt attributes in order to make  
their document conforming. (I will discuss this more in a seperate mail).

I would change the fourth paragraph as follows:
"The alt attribute does not represent advisory information. User agents  
should clearly distinguish the content of the alt attribute from the  
content of the title attribute in presenting them to the user."

-- 
   Charles McCathieNevile, Opera Software: Standards Group
   hablo español  -  je parle français  -  jeg lærer norsk
chaals@opera.com    Catch up: Speed Dial   http://opera.com

Received on Monday, 25 June 2007 05:46:05 UTC