Use image description as alt text
For attached images, ATTACHEDIMAGEFORMAT uses by default the file name as alt text. Wouldn't it be more logical to have its description as the default alt text?
Page contents:
Background
The image file name does not reveal that much. I've looked for advice at
http://www.w3.org/TR/html401/struct/objects.html#h-13.8
and
http://www.webaim.org/tutorials/alt
:
Images and graphical buttons: If an image is only used for decoration, add a descriptive alt tag.
That's about the amount of useful information on that page... Thinking about this more, it would be more useful if the alt text shows it is an image, like: alt="image: screenshot of my homepage". Looking a bit further I found this document at
http://aad.uoregon.edu/culturework/tj/access.html
that confirms that the alt description should not only have a short text description:
One difficulty with such conciseness is that the text when read by a speech program working from LYNX, the text may not differentiate itself adequately from surrounding text as being a description of a graphic. So it may be useful to add a word such as image, with a colon, to preface the description:
<img src = "1tj.gif" alt = "image: wall painting of word "STET" and self-portrait of artist">
Joe Clark in "Building accessibile websites" tells me not to use "image:" in alt tags. The screen reader will provide for this. In an alt tag, just give the description of the image, no meta data.
Solution
So taking this to the preference settings, the default setting in TWiki.TWikiPreferences could be:
* Set ATTACHEDIMAGEFORMAT = \t* $comment: <br /><img src="%ATTACHURLPATH%/$name" alt="$comment" $size />
--
ArthurClemens - 13 Nov 2003
Comments
This is a sensible enhancement request. One detail: The
$comment might contain illegal chars for the alt tag, like double quote. Possibly introduce a new
$altcomment variable?
--
PeterThoeny - 14 Sep 2003
It's already possible to use $comment - just set it in the preferences. To prevent breaking the
HTML, either:
- Don't accept quote characters in the attachment description field (throw them away)
- Convert quote to
"
- Convert quote to single quote
There is a bug with using quotes and ampersands in the comment field. See
BugWithQuotesInAttachmentComment.
--
ArthurClemens - 15 Sep 2003
Conclusion
The proposal can be implemented straight away - just change the
TWikiPreferences. To fix an existing bug with illegal characters, see
BugWithQuotesInAttachmentComment.
--
ArthurClemens - 13 Oct 2003
I made the change in
TWikiPreferences on twiki.org.
--
ArthurClemens - 22 Feb 2004
See also:
ConfigurableAttachLinkFormat