[whatwg] Please consider simplifying authoring guidance for the <img> alt attribute

Markus Ernst derernst at gmx.ch
Tue Aug 3 02:58:41 PDT 2010


Am 02.08.2010 20:54 schrieb Ashley Sheridan:
> On Mon, 2010-08-02 at 17:19 +0200, Markus Ernst wrote:
>> - search engines should generally ignore text in the alt attribute, but
>> evaluate the title attribute instead
>>
>> Rationale:
>>
>> 4.8.1.1.12 says: "A corollary to this is that the alt attribute's value
>> should never contain text that could be considered the image's caption,
>> title, or legend. It is supposed to contain replacement text that could
>> be used by users instead of the image; it is not meant to supplement the
>> image. The title attribute can be used for supplemental information."
> 
> What you said doesn't make sense. The alt text is to be used instead of 
> the image, and the title is for supplemental content. Therefore, search 
> engines should use alt text, as that is what they are attempting to 
> convey in the lost (in the sense that search engines don't process 
> images like they do text) image. If they used the title, one can only 
> imagine the trouble.

Ok, maybe the search engine aspect obfuscates the main statement I 
wanted to make; let's just drop it and try to be some more specific.

4.8.1.1 says: "Except where otherwise specified, the alt attribute must 
be specified and its value must not be empty; the value must be an 
appropriate replacement for the image. The specific requirements for the 
alt attribute depend on what the image is intended to represent, as 
described in the following sections."

In the sub sections, many cases are stated where the alt attribute must 
be set to the empty string, and some cases where the alt attribute can 
even be omitted. These seem to be the ones that are considered to be too 
complicated.

My point is, that it would simplify things (e.g. the cases treated in 
the links Tantek provided) a lot to do it the other way around:
- Declare the alt attribute as optional, and default a missing alt 
attribute to alt=""
- Explicitly specify the cases where the alt attribute must be set 
(e.g.: if the image is the only child of an <a> or <h1-6> element)
- Update some of the authoring guidance in the sense of encouraging 
authors to apply alt text where appropriate, and omit it where not (I 
specially think of 4.8.1.1.9 here; I will post a separate proposal about 
this section)

I doubt that there is much benefit in the requirement for the alt 
attribute, for the following reasons:
- The paedagogig aspect of making a document invalid if an alt attribute 
is omitted is obsolete, as authors have got used to just insert alt="" 
if they are too lazy to write an alternative text, and many authoring 
tools even insert the empty string by default if the author does not 
specify an alt text. Bad authoring cannot be prevented by structural 
specification.
- I have no personal experience using screen readers or text-only 
browsers, but I am quite sure that unnecessary (not speaking of 
inadequate) alt text is not helpful, but even harmful as it interrupts 
the reading or listening flow. (If screen reader or braille browser 
users contradict me here, I am happy to learn, of course.)



More information about the whatwg mailing list