Alt? Longdesc? Title? What Goes Where, Especially For Image-heavy Sites?
Solution 1:
The alt
attribute is for alternative text, i.e. textual replacement for an image, so in the example, it is adequate if it reasonably tells the same story as the image. In reality, most images cannot have texts that are full “alternatives” or “replacements”; it’s usually a matter of capturing some of the most essential message, if possible.
An alt
text can be of any length. The statement that alt
texts should not be descriptions does not mean that it cannot be detailed if needed. The point is that there are too many descriptions that say something about an image without conveying its message (like “big red bullet” or “A man in a canoe”).
The longdesc
attribute is supported by some software but highly debated and not part of W3C HTML5 CR but being developed as an independent “extension”.
The figcaption
element is for captions presented along with an image. It does not address the issue of alternative text at all. It is meant to be presented to the user, whether he sees the image or not.
Solution 2:
If you want to provide complex alternative text (where "complex" could mean: containing lists, tables, audio/video etc.), you could either use an img
element with a longdesc
attribute, or an object
element instead of img
.
longdesc
In HTML 4.01, longdesc
is part of the specification. In HTML5, it was removed, and is now developed as an HTML5 extension (but it’s currently only a Working Draft from 2013Update: it became a W3C Recommendation).
Problem: You would either have to include the content on the same page, but then you shouldn’t visually hide it (as not only screen reader users may want to access this content). Or you would have to add separate pages for the content (but then search engines won’t relate this content to the image, i.e., you miss on ranking potential).
object
The object
element can be used for any kind of media. Its content is the fallback content, which allows you to use markup for the alternative text.
<objectdata="appleeat.png"type="image/png"><!-- the alternative content goes here --><p>A man bites into an apple. As it turns out, there's a worm in it!</p></object>
Solution 3:
Here’s some discussion of alt text that might apply to your situation:
Although I agree with @Jukka that long alt text isn’t a problem in itself. It’s true that “alt text isn't for descriptions”, but only because alt text is for equivalent content. If the equivalent content to a particular image is a description of it, then that’s fine.
It’s just that for lots of images used on the web, that’s not true. For example, the best alt text for the Stack Overflow logo at the top of this page wouldn’t be
The Stack Overflow logo: an abstract in-tray overflowing with paper, followed by the word “stack”, and in bold, the word “overflow”
It would just be “Stack Overflow”, because that provides an equivalent experience for a partially-sighted person (i.e. it tells them which website they’re on).
But if your images are cartoons, I guess writing alt text for them is a bit like doing audio descriptions for movies. You need to be more descriptive if you want to provide an equivalent experience. It’s certainly a challenge, especially if you don’t have experience, or partially-sighted users to discuss it with.
Joe Clark, in his book “Building Accessible Websites”, discussed describing images:
And even providing alt text for comic strips, although his example is for dialogue-heavy strips, and I’m not sure what sort of experience it provides in today’s screen readers:
Solution 4:
Most people now use a figcaption
as a caption under an image in an article, or for a short image description, like so...
<figurearia-labelledby="myimage1" ><imgid="image1"src="myimage.jpg"width="100"height="100"alt="image:My Image"title="Image of Something Cool" /><figcaptionid="myimage1">This is My Image Caption!</cite></figcaption></figure>
However....since you are associating a larger description with your image, and it is not needing a caption, try this...
<divrole="img"aria-labelledby="myimage2"><imgid="image2"src="myimage.jpg"width="100"height="100"alt="image:My Image"title="Image of Something Cool" /><pid="myimage2">Larger description of my image...</p></div>
This is also compatible with WAI-ARIA accessibility standards, which will read and associate your container "div" and your "p" description with the image. Notice the new attribute, role=img
. Since the div
, unlike figure
, is not normally associated with an image, this helps the screen reader identify the div
container as part of the image.
ADDITIONAL
Note that the alt
attribute should be a text replacement for an image if the image never appears, a user agent cannot read images, or the image is slow to download. I like to show this info in a grey background image box in case a image breaks and a user needs to know what is missing. Its designed to tell a user what the image represents in a simple, short text string.
The title
attribute on images is an important rollover box that gives additional image information, image map feedback, or where it would link to when the image is a clickable hyperlink. Some designers frown on the title
attribute but I use it all the time in a lot of my HTML to add rich info to all my interactive and visual elements.
Solution 5:
I think adding in descriptive text in a <figcaption>
is a good idea. There is of course the problem with browser support, this should be able to be addressed with CSS:
figcaption { display: block; }
You could then hide this text by default figcaption { display: none; }
and include a link somewhere that will refresh the page with the captions displayed through an alternative style - figcaption { display: block; }
This option then eliminates the need for javascript solutions and only gives captions to those that specifically request them.
You could maybe set this up with a little bit of php:
<head><styletype="text/css"><?phpif(isset($_GET['CaptionDisplay']))
{
echo'figcaption { display: block; }';
}else{
echo'figcaption { display: none; }';
}
?></style></head>
HTML Link - <a href="example.php?CaptionDisplay=true">Show captions</a>
This is completely off the top of my head :) Let me know if I can better explain anything.
Post a Comment for "Alt? Longdesc? Title? What Goes Where, Especially For Image-heavy Sites?"