Too much accessibility - the rise and fall of the LONGDESC

In the last two months I’ve come across more examples of the LONGDESC attribute in use, than I’ve seen in as many previous years. Due to this apparent rise in its popularity, this seems like a good time to look at when the LONGDESC can be useful, and when it’s just a waste of code.

This seems to deserve an airing because, in the eleven times I’ve encountered it this year, only one functioned as it should. The other ten either couldn’t function, or had no description to offer. With that in mind, lets look first at the purpose and correct way to add a LONGDESC to an image.

What is a LONGDESC?

It’s no more than a long description for acomplex image. When there’s so much information within an image, that the ALT attribute would be too long, the LONGDESC gives you the opportunity to provide a subtle link to a different page, where the image is fully described.

The value applied to the LONGDESC attribute needs to be the uri of the descriptive HTML or text page.

Example of workable LONGDESC

The code that would correctly apply a LONGDESC attribute could be:
<img src="whitby01.jpg" alt="Sunset over the water at Whitby" longdesc="whitby01desc.html" />

Then you’d need a very simple HTML page called "whitby01desc.html" to deliver the description, which might be:
“A deep orange sun sinks toward the seaward horizon lighting up the waves off the East coast resort of Whitby.”

How it should work

Screen readers can announce the presence of a LONGDESC applied to an image, JAWS announces the ALT attribute, followed by “Press enter for long description”. On pressing enter, the description page loads in a new browser window, (by default), so that the user doesn’t lose their place on the original page.

I’ve yet to find any evidence that people who don’t use screen readers can access the long description page at all, which is a shame, as it could be useful for screen magnification users, certainly more useful than a lengthy ALT text.

This all seems quite simple. So what goes wrong?

Incorrect applications of LONGDESC

The ten sites that had faulty applications of LONGDESC made at least one of three errors:

  • Two sites used the long description as the LONGDESC value. This obviously wasn’t announced, and there was no link to follow, so that was a wasted effort.
  • Three sites used “#”, or the uri of the current page as the LONGDESC value. This meant that a new window opened, but it only presented the user with the same page as the one they’d just left. Oh my!
  • Seven sites used LONGDESC, either correctly or as in one of the ways above, but on linked images. This just can’t work.

The problem with the last technique is that the same keystroke, (Enter key), is used to launch both the LONGDESC page and the destination of the link. It shouldn’t happen, but it does. W3C warned about this in the HTML4 specification:

“Since an IMG element may be within the content of an A element, the user agent’s mechanism in the user interface for accessing the “longdesc” resource of the former must be different than the mechanism for accessing the href resource of the latter. “

Put simply, this means that browsers should respond to a different keystroke to open LONGDESC information than the one used to open links. This hasn’t happened, so applying a LONGDESC to a linked image is wasted effort.

LONGDESC, a fall from grace?

As the subtle way of providing a long description seems to cause confusion to web authors, I’d like to suggest an alternative. This would also solve the more important problem that a properly implemented LONGDESC isn’t accessible to people who aren’t screen reader users.

How about putting a short text link adjacent to the image, leading to the description page? In the Whitby sunset example, if the image and text were wrapped into a single link, the text could just be “Image description”. Visually the relative positions would inform users which image this refered to, and screen readers would hear both the ALT and text announced as a single link, “Sunset over the water at Whitby: Image description”.

Alternatively, the link text could be more descriptive, and leave the image out of the link.

Either of these techniques would make the long description available to everyone. Of course you’d need to decide whether or not to open the link in a new window, and how to let users know it’ll happen.

If anyone knows of a way to make the LONGDESC linked page available to all users, please pipe up. I’d be happy to support it if it can support all users, otherwise, isn’t it time we took it out of the web authors’ accessibility toolbox?