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

Ian Hickson ian at hixie.ch
Wed Aug 25 12:28:31 PDT 2010

There was some recent feedback on the <img alt> attribute. I have quoted 
some of it below. I haven't changed the spec: none of the points raised 
were new information.

On Mon, 2 Aug 2010, Markus Ernst wrote:
> Am 01.08.2010 11:43 schrieb Tantek Çelik:
> > http://wiki.whatwg.org/wiki/Img_Alt
> My personal opinion on the alt attribute is that:
> - it should only be used if the image is crucial for understanding the
> content, or for navigation (such as headline or link images or charts)
> - it's absence should default to what is alt="" in HTML4
> - search engines should generally ignore text in the alt attribute, but
> evaluate the title attribute instead
> Rationale:
> 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."
> The most common use cases of @alt are (at least as far as I know from my
> authoring practise):
> - Insert the text contained in a headline or link image
> - Insert an empty string to make the page validate
> - Insert a short description of the image, preferably containing some keywords
> for search engines; sometimes the search engine aspect is weighted even higher
> than the contents of the image here
> Only the first one of these use cases matches the gideline given in
> The second one is not harmful, exept some minimal bandwidth
> impact. But the third one is actually counterproductive with regard to
> accessibility.
> An image which conveys information, if it is not a text replacement (such as a
> headline or link image), a corporate logo, or some kind of chart, is usually
> almost impossible to describe in a way that can't be considered the image's
> caption, title, or legend. Usually, the information conveyed by the image is
> either duplicated in the text that the image is associated to (or in it's
> caption or legend), or at all useless for anybody that does not see the image.
> Either way, the presence of an alt text does not provide useful information,
> but possibly confuses - specially if it is written with regard to search
> engines.
> I am confident that declaring the alt attribute as optional would not only
> simplify the spec and validation, but also have no significant effect
> regarding accessibility, as poor authoring cannot really be prevented by
> structural means.
> And I am also confident that if search engines ignored the alt attribute, and
> authors were encouraged to only insert alt text if helps to understand the
> content, this would have a positive effect on accessibility, as authors would
> be discouraged to put unnecessary information in the alt attribute for seo
> purposes, or duplicate the legend or caption (what I used to do before I read
>, because HTML4 seemed to require exactly this).

On Mon, 2 Aug 2010, Ashley Sheridan wrote:
> 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.

On Tue, 3 Aug 2010, Markus Ernst wrote:
> 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.
> 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
> 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.)

On Tue, 3 Aug 2010, Ashley Sheridan wrote:
> If the content of the alt attribute is interrupting the flow of the 
> text, then it is either not describing the image it represents well, or 
> the image is not something which should appear in the flow of text at 
> that position. HTML5 brings many new layout devices which can help lay 
> out the code in a logical and coherent manner, while still rendering on 
> screen in the traditional manner. I do test thing in text browsers, and 
> frequently see bad alt text markup on sites along the lines of 
> alt="Company Logo" or somesuch, where in-fact it should have read 
> alt="ACME Trading Co." because that is the text that was on the image 
> anyway.
> I agree that there is a lot of bad markup out there with lots of empty 
> alt attributes, inserted only to pass the validators, but I think making 
> the attribute optional would just cause further accessibility issues. 
> Better to improve the validators to give warnings about empty alt 
> attributes (only warnings rather than outright errors) to notify the 
> developer that there could be a potential issue with the markup.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list