I was recently asked about alt, figcaption, and longdesc being used together. 

If an <img> tag is missing an alt attribute, a validation error occurs. However, if figcaption is present, a missing alt attribute is no longer an error. Most likely the reason for this is that the alt and figcaption text could be the same: a short, textual description accurately labeling the photo. However, I don't think the two are the same. 

For instance, in the photo attached to this post, I'd use the following for alt text:

The body of the elephant Gypsy, and the man, Dampier, who shot her sitting on top of her body with his rifle. 

For the caption, I'd use:

Photo of Chief Calvin Dampier sitting on top of Gypsy. Photographer uncredited, courtesy of the Ray City Community Library

Would I use a longdesc? I would if it's important in the context of use to convey visual cues and information that provide a more comprehensive appreciation of the image. In this case, since I'm trying to tell a story about the mostly negative co-existence between circus elephants and humans in the history of circuses in the US, I need to provide more of the story. I would use something like:

The photo was taken in 1902, and the clothing reflects the period. Most of the men are wearing jackets and ties, and all the people are wearing hats. 

Sheriff Dampier is holding a very powerful rifle, with a seeming self-congratulatory smile on his face. There are several people in the background and surrounding Gypsy and the Sheriff.

A woman stands to the side, with her hand over her mouth, seeming to reflect upset at either the dead elephant, or the event, or both. The elephant's body is turned away from the camera, with Dampier sitting on her side, left leg hooked over the elephant, and rifle resting on his knee pointed to the sky. 

It's a classic trophy pose. 

Would I include this text in the caption? Of course not, it's too long. Would I include it in the text surrounding the photo? Unlikely, since most of the text is nothing more than a verbal description of what the photo clearly conveys.

Not everyone would agree with me that the photo needs a longdesc, but whether you do or not, what's important to note is that the text for all three HTML components—alt, longdesc, and figcaption—is different because each serves a different purpose. 

Speaking of longdesc, many thanks to Mozilla for deciding to implement longdesc in Firefox. 


More on the story of Gypsy and her ending:

Shared publiclyView activity