WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Question about image in the alt attribute

for

From: Jukka K. Korpela
Date: Aug 1, 2014 2:33PM


2014-08-01 22:21, Jonathan Metz wrote:

>> No, I did not mention the <src> tag
>
> The link you originally provided…
[...]
> …references the src attribute:

Attributes are not tags. And it's the alt attribute, not the src
attribute that is being discussed

>> and yes, I
>> am advocating the use of an alt attribute for the purpose it was
>> designed for and has been defined in HTML specifications.
>
> But that is not where you were linking to. The definition is found here:
> <http://www.w3.org/TR/html5/embedded-content-0.html#alt>;

All HTML specifications, and also HTML5 drafts, define the alt attribute
as specifying a textual replacement for the image, for use when the
image is not displayed. They are partly rather sloppy in their wordings,
also referring to "descriptions" rather than replacements, but the
definitions proper (as opposite to annotations) are rather clear.

Most importantly, we need to decide whether an alt attribute is written
to act as a replacement (for use when the image is not seen at all) or
as an annotation/commentary/description. You can't have it both ways, in
general.

>> This simply means that the alt attribute is to be rendered *instead of*
>> the image. The phrase "making visual information accessible" is poorly
>> formulated, since alt attributes are not meant to make blind people see.
>
> I guess if WCAG were written for the sole purpose of helping blind people
> access content, that comment might make more sense to me. Yet WCAG is not
> implying that "making visual information accessible" means "providing the
> gift of sight". Instead it is implying more than one way of providing
> information.

In the case of <img>, the HTML language provides exactly two alternative
ways: an image and a piece of text. How the text (when it is rendered)
is presented to the user will depend on the browser.

>> Instead, they are the way to make *some* information available to people
>> who do not see the image.
>
> Yeah, true… That would be ONE reason for using alternate text. But there
> are other reasons too:
>
> 4.7.1.1.1 Examples of scenarios where users benefit from text alternatives
> for images
>
> * They have a very slow connection and are browsing with images disabled.
> * They have a vision impairment and use text to speech software.
> * They have a cognitive impairment and use text to speech software.
> * They are using a text-only browser.
> * They are listening to the page being read out by a voice Web browser.
> * They have images disabled to save on download costs.
> * They have problems loading images or the source of an image is wrong.

These all mean that the image is not seen.

>> Realistically speaking, when the image is a
>> photo, for example, the alt text *cannot* correspond to the visual
>> information very well.
>
> I don't think I understand you here. Are you saying that if a photo is
> included, there is no way to describe what is going on in the photo?

Yes. You might be able to describe part of its content somehow, but it
is an illusion to think that one can write adequate textual replacements
for photos, except in rather trivial cases. Pick up any photo from your
personal photo gallery and think how you would describe its content over
the phone. Of course you can tell that it is a photo of uncle Joe, but
that would apply to any photo of uncle Joe, so it can hardly contain the
information content of a particular photo.

>> Purely decorative images and
>> text as images are the most obvious cases. This is where the alt
>> attribute does its job well when written to act as a replacement, not a
>> description (say, "item" or "bullet", not "red fancy bullet with
>> blinking eyes").
>
> Wait. What? Why would you provide information for purely inconsequential
> items?

When an image is used as a list bullet, I would use alt="item" or
alt="bullet" or something like that. Wouldn't you? Or would you explain
all the details of the bullet image?

>> That's a manifestly poor example. Those random words are excerpts from
>> the dictionary. When I look at them, I can see that it is an English
>> dictionary, or a French dictionary, or a Greek dictionary, or whatever
>> it might be. It's far from being "pure decoration".
>
> Sorry, I didn't write the example: it's from WCAG.

You mentioned it, and I explained why it's a poor example.

> Still, if you came
> across a subtle background of a seashell pattern on a web site about coral
> plant life, would you really want to be notified that the designer used a
> repeating clip art graphic?

No, not any more than I want the random words read aloud. As I wrote,
alt="" is adequate, but definitely not because the image is purely
decorative

>> But it's an image for which alt="" is adequate, on the simple grounds
>> that this is the only no-nonsense approach. There is no way (or at least
>> I cannot see a way) to present the same information in a non-visual way
>> in a similarly non-disruptive manner.
>
> So… You're agreeing that this was a good example then?

No, it's a poor example, because it presents the case as an example of
purely decorative image, when it is no way near purely decorative. A
nice image of a beautiful butterfly is purely decorative on a page that
has absolutely nothing to do with butterflies. On a page about insects,
it is a topical image. On a page about butterflies, even more so.

> However, if I come across content I don't understand and inspect an
> accompanied photo to learn it doesn't have alternate text, I assume that
> it's just filler. I'm still lost, but now I can focus on trying to
> understand the information in the content rather than how the content
> relates to a stock photo.

You draw such conclusions at your own risk. The alt text isn't even
meant to be seen when the image is displayed. There are myriads of
reasons, some of them rather good, why an image might have alt="" even
though seeing it helps in understanding the page content. If there is no
way to help a person who does not see the image the same way as the
image may help a person who sees it, it is much better to use alt=""
than to write something that does not help.

In order to explain how a photo relates to the rest of the content, or
vice versa, normal text should be used, in running text or as an image
caption. After all, that text would be meant for people who see the
image, not to those that don't. It's just unfortunate that there is no
way in HTML to make such texts shown only when the image is shown.

Yucca