Can the alt attribute be omitted without hurting accessibility?

In the current editor’s draft of HTML 5, it is suggested that the alt attribute for img elements should no longer be required. The reasoning is that in some cases alt text will be omitted, regardless of whether it is required or not, so it might as well be made optional. Otherwise some authoring tools will automatically insert empty, repeated or meaningless alt text. At least that’s how I understand the reasoning explained in Why the Alt Attribute May Be Omitted.

Basically it seems to come down to “Many people and many tools aren’t using the alt attribute properly, and adding alt text to images uploaded to online photo galleries like Flickr is too much work for end users and tool developers, so the alt attribute should be made optional.” Is that really the best solution though?

To help authors write useful alt text, the HTML 5 specification should provide guidance on that. I am pleased to see that the section describing the img element in the current draft does that well, except for the first example which seems a bit too long (and contains information that all users would benefit from). The rest of the examples are good. They could be worked on, but they are good.

Despite that guidance, there will always be cases where alt text is missing, either because of broken authoring tools or because of author ignorance or laziness. So the specification needs to define how user agents should handle missing alt attributes. In no way does that necessarily mean that images with missing alt attributes should be valid HTML 5.

Concerned that omitting the alt attribute might lead to increased problems for users of assistive technology, most notably screen reader users, Steve Faulkner conducted a series of tests. During the tests, Steve recorded the output from a screen reader confronted with pages containing images with and without alt attributes. The results and his conclusion are presented in Investigating the proposed alt attribute recommendations in HTML 5.

If you read Steve’s article you will see that omitting the alt attribute leads to the tested screen readers announcing the value of the img element’s src attribute when an image is in a link. In many cases the filename contained in the src attribute is pure nonsense that does not provide the user with any useful information about the image.

The text-only browser Lynx has similar behaviour to the screen readers Steve tested in that it displays the filename of linked images that have no alt attribute.

The HTML 5 draft somewhat cryptically suggests that Non-visual user agents should apply image analysis heuristics to help the user make sense of the image. It would be very interesting to learn more about how those heuristics are supposed to work. Have vendors of non-visual user agents been consulted to find out if this is at all possible? How are non-visual user agents supposed to figure out the author’s intent by analysing an image?

Omitting the alt attribute clearly causes problems in some cases, so it is not a very good option. I have seen suggestions of a couple of other solutions that I think are better, though neither is perfect.

One is to add a noalt attribute that is to be used when alt text for some reason cannot be specified. I think it is a much better idea than simply allowing the alt attribute to be omitted since it makes it explicit that the author (or authoring tool) has intentionally not supplied an alt text. This would make it easier to use validation to check for mistakenly missing alt attributes.

Another solution could be that the alt attribute may be omitted only if the image is inside a figure element that contains a legend element, the contents of which may then take the place of alt text. An example from the current editor’s draft of HTML 5:

	<img src="1100670787_6a7c664aef.jpg">
	<legend>Bubbles traveled everywhere with us.</legend>

In this case the text in the legend element can give the user at least some indication of what the image contains, and would be much better than being presented with the image’s filename.

To me, both of those options seem much better than simply making the alt attribute optional.

One problem remains though. To be backwards compatible with current Web content I believe screen readers (and any other user agent that does not, permanently or temporarily, support images) will need to keep announcing or displaying something when the alt attribute is missing. In most cases the only thing available for them to display will be the image’s filename, which as we have seen is often useless.

So, after much thinking back and forth on this subject, I’m not convinced that making the alt attribute optional is a very good solution. Gez Lemon seems to share my opinion, and explains his reasoning in The HTML 5 Image Element (where he also brings up the longdesc attribute, which is missing in the current editor’s draft of HTML 5).

Like Gez, I believe that we need to keep encouraging the developers of authoring tools and applications like Flickr to improve how their systems handle alt text. Making the alt attribute optional won’t help—it will only lead to lazy and ignorant authors and tool vendors ignoring it completely.

Posted on September 7, 2007 in Accessibility, HTML 5