Seeking Best Accessibility Practices

Clarifying ALT Text for WordPress Bloggers and Developers

Coming out of retirement briefly, I write to support Glenda Watson Hyatt who yesterday lamented that WordPress still doesn’t get the very first accessibility requirement right. Bluntly, at release 2.8.4, WordPress still does not do ALT text correctly. Bloggers inserting images into their WordPress blogs are not being well served. Good craftsmen everywhere are taught to blame themselves for poor work rather than their tools. In this case, we can blame the tool. It needs sharpening.

Maybe I can cast Glenda a helping hand, not that she needs any help, by approaching the problem from a different point of view, from that of standards compliance, but tempered with explanations that are more easily understood than the W3C specs. In a comment to Glenda’s post, I suggested reading the specs. Yet, people using the WordPress tools are not always developers and shouldn’t have to know or understand those specs.

My intention here is to describe those specs in plain English, and to make suggestions for how WordPress can improve.

The discussion involves two “elements,” IMG and CAPTION, and two “attributes,” ALT and TITLE. Think of “elements” as containers, or envelopes. They are uniform carriers for what is inside them. Think of “attributes” as things inside the containers which offer additional precision.

IMG element

The IMG element is, of course, the container for images. Inside we find a pointer to the image and a number of allowable attributes. For the sake of completeness, the attributes are: src, id, name, alt, lang, title, style, onclick (and 9 other on… attributes), ismap, usmap, longdesc, align, width, height, border, hspace, and vspace. Only two of these are pertinent to our WordPress discussion, alt and title.

alt attribute

The alt attribute is intended for providing an alternate description of an image. The intent satisfies two cases. For browsers that do not or can not display images, the alt text describes the thing that is not seen. The other case is to give blind people a description of what they cannot see. The alt attribute is currently a REQUIRED attribute. It MUST be specified. Beyond the basic HTML specifications, the World Wide Web Consortium’s (W3C) Web Content Accessibility Guide also makes alt attributes for images REQUIRED.

Yes, there are exceptions, but before we get to those, here is what happens to the alt attribute. In browsers that are unable to display images, or have images display turned off, the alt text is used inside brackets or parenthesis to describe the missing image, for example (picture of dog rescuing swimmer). People who are blind use assistive software called screen readers. As the name implies, this software determines what is on the screen and “reads” it through voice synthesis to the blind person.

You can easily find long discussions about what images deserve alt text, which ones don’t, and what constitutes good alt text. Briefly, the only images that do not need alt text are those that are used for positioning, the ever present “spacer” gifs, and those that are purely decorative. Even the picture of the dog rescuing the swimmer might be considered decorative by some. Yet, even with these non-essential images the alt attribute must be coded and should be coded as alt=”". That is, two immediately adjacent quotes with no intervening spaces.

All other images need the alt attribute to describe the image. For the images such as drawings, illustrations, photos and charts, the most succinct brief description is appropriate. For images of buttons or other objects representing actions, the description of the action is appropriate, for example “submit button.” There are many ways to do alt text either very well or very poorly, but I don’t intend to go into those here. See references at the bottom of the article for good suggestions.

Oh, some readers may be aware that the next version of HTML, version 5, might not require the alt attribute. That is really not yet settled and the current draft of HTML 5 offers a variety of conditions. Those interested can read the draft.

title attribute

The title attribute is intended to provide additional information about the image. Title attributes are optional and can be applied to a great many elements other than image and are more generic in their nature. In our simple case of the dog rescuing the swimmer, the title text might be “Spot saving Dan.”

Many of today’s browsers display the title text when one hovers over an element that has a title attribute. A point of historical reference is useful here. The hover capability came from an implementation mistake that Microsoft made with Internet Explorer many releases ago. In that browser, Microsoft displayed the alt attribute as hover text. That was corrected later, making title the source of the hover text. It’s little wonder that people are confused by these.

The point is that title should be used for additional or advisory information, not as a substitute for alt text. As an example of advisory, think of a form full of fields. Some of those fields might have a title of “required information” to encourage correct completion.

Titles are not substitutes for the alt attributes and should not be used as such. Nor should we use the same value for both alt and title. That introduces redundancy that is very annoying for a blind person listening to a screen reader. In fact, because of so many developers who chose to irrationally duplicate alt and title text, many screen readers now have title announcement turned off by default. The redundancy became so annoying that blind people said they would rather do without the title information, even when it might be useful.

CAPTION element

Caption? Why are we talking about caption? The reason I ask is because the CAPTION element is an independent element that is intended to be used with TABLES. In fact, the specification is very precise about this, saying “When present, the CAPTION element’s text should describe the nature of the table. The CAPTION element is only permitted immediately after the TABLE start tag. A TABLE element may only contain one CAPTION element.” From this we know with certainty that the CAPTION element is optional, is associated with tables, and most be coded in a certain sequence for tables.

It is not an attribute for the IMG element and nowhere in the W3C specifications are captions ever associated with images.

On the other hand, some people do like to add caption-like information to pictures. In some cases, it might be a photo credit. In other, it might be yet more information about the image. However, that wasn’t what the HTML designers were thinking when they wrote the spec. Is it fortunate of not that most browsers are forgiving enough to not care about a caption outside of the correct place inside a table specification? The forgiving nature of browsers led developers to use the element for purposes other than those the designers intended.

Where WordPress gets it wrong

Following is the dialog for adding images to WordPress blog entries.
capture of add an image dialog

Let us count the problems:

  1. There is no way to specify ALT text. Actually, there is, but it is well hidden.
  2. The Title field is marked as required when in fact the attribute is optional.
  3. To make it easy for people to do the wrong thing most of the time, the Title field is pre-filled with the image’s file name. More often than not, file names are not useful as either title or alt text.
  4. There is a Caption field which is valid only for tables, not for images.
  5. UNSEEN - If no caption is specified, the Title value is duplicated into the ALT text. I’m guessing the developers though most people would recognize what “title” means, but not what “alt” means, and blindly duplicating is easier than explaining.
  6. UNSEEN - If the caption is specified, the caption’s value is duplicated into the ALT text. This is even farther form the spec than using the title text.
  7. There’s no help for what any of the fields mean.

For the person in a hurry, who cares little about the details, we end up with what Glenda calls “Worse than Useless.” We have identical alt and title text, both specifying the image’s, usually cryptic, file name.

Ah, but there’s more….

In a very obscure effort to do things right, there’s an Advanced Settings dialog that includes a real, honest to goodness, field for alt text. If you really, really, really know what you are doing and really, really, really want to do it right, you can add an image, and then go to the Advanced Settings dialog to make the alt text correct.
capture of advanced settings dialog

However, getting to it is difficult. First, you have to complete the “Add an Image” dialog by pressing the “Insert into Post” button. Then, you have to find the image in the post and click on it. The, click on the button to “Edit Image.” After that, find and select the “Advanced Settings” tab.

Let’s recap. WordPress has an underlying understanding that alt text is required for images. However, they adopted the very poor practice of thinking title text more important and auto filling alt text from the title text. Then, a couple of releases ago, someone came along and injected the caption element into the mix, both misusing it and abusing it to auto fill alt text. To those of us acquainted with the standards, these combinations, especially the use of optional attributes to auto fill required attributes, are bizarre.

Lastly, there’s yet one more accessibility related standard that has been ignored. The Authoring Tool Accessibility Guidelines talk specifically about how the tools used to build web pages need to be accessible themselves, but also need to generate standards compliant code. WordPress fails here by not doing the right things with the “Add an Image” dialog, and by hiding the right things somewhere people are unlikely to discover.

Suggestions

The fix is simple. Do it right. Include a field for alt text. Make it the required field. Let title be an optional field. For complete standards compliance, get rid of the caption field. Yet, I can understand why some would want to keep it. Maybe the Advanced Settings dialog could be eliminated to make things easier? Lastly, and perhaps as important as all the other changes, provide good help information that informs the typical blogger about why alt text is required and what constitutes good alt text.

For further reading:


23 Responses to “Clarifying ALT Text for WordPress Bloggers and Developers”

  1. Glenda Watson Hyatt Says:

    Bob, thank you so much for coming out of retirement for this thorough yet easy-to-understand post. This is a must read for all WordPress bloggers, at least until the alt issue is rectified.

    I hope you’ll continue coming out of retirement occasionally. Your wisdom and knowledge is much needed!

  2. Mike Says:

    Just found that advanced settings bit in WordPress (had never seen or heard of it before). Is there not a longdesc attribute that you can put on images too (never used it TBH) - any advice on if it should be used and if so how.

    Cheers
    Mike

  3. Bob Easton Says:

    Mike, yes, longdesc is one of the optional attributes. It is intended for those times when you need more than a few simple words to adequately describe an essential image. I wouldn’t use it to describe the lovely old grist mill sitting in the shade of the mighty oak trees, but might consider it if I wanted to mention the values of data points on a graph or chart.

    longdesc is hard to use for two reasons. First, it requires an additional HTML file, or a named section of the existing page, to hold the long description text. Then a link needs to be provided so those who want it can access it. There’s no automatic display of longdesc. You have to make it happen with a link to it, and with appropriate CSS styling. It is not one of those attributes that you will find in an “add image” interface like WordPress or Dreamweaver, and I doubt that many WordPress theme designers have given it any consideration. It really is very rarely used … the HTML Dodo bird.

    If you want to use longdesc, you will need to hand craft the HTML. Back when I worked for a living, I created a template for the quarterly financial reports. Each report had several bar or line chart images. Below each was a caption-like link (not a table’s caption element) that linked to named sections at the bottom of the page. People could follow the links below the images, or page down to the bottom to find the charts fully described. It was one way, not the only way, and it worked for those reports.

    For more detail, Webaim has a very good article about using longdesc.

  4. Christopher Wyble Says:

    Bob, it’s always great to read your commentary. Just had a great conversation yesterday with several of your old colleagues at the HA&AC.

    I’m a Wordpress user myself, but rely on Windows Live Writer for my blogging interface. Live Writer has a similar, though not quite as extreme, problem… users have to add an image, then click on the “advanced” tab to edit alt text, but at least once you get there, it’s correctly labeled as alternate text.

    This seems like such a simple, easy fix; it’s striking that we’re still talking about this gap in function in 2009.

  5. Bob Easton Says:

    Good to hear from you Christopher. Thanks for stopping by.

    We get to “gaps” like these for a couple of reasons. First and foremost is that few developers have had the good fortune to have as much accessibility background as you and I have. Some of that, of course, is environmental, working for firms that have strong (or weak) accessibility commitments makes a very big difference.

    The second reason is technical complexity. WordPress, like most any product that does something useful, has many layers, and sometimes dependencies on external components. There are lots of opportunities for factors to get missed and for unexpected consequences to pop up. I’ve spent most of the morning digging through the layers in WP and have gotten only a little closer to the place where a bug can be fixed.

    Lastly, there’s always the prime complaint of the accessibility consultant; accessibility issues too often get prioritized to the bottom of the list.

    Enough ranting. Back to digging…

  6. Laura Carlson (lauracarlson) 's status on Wednesday, 30-Sep-09 17:01:46 UTC - Identi.ca Says:

    […] http://www.access-matters.com/2009/09/29/clarifying-alt-text-for-wordpress-bloggers-and-developers/… a few seconds ago from web […]

  7. Laura Says:

    Draft Text for the HTML 5 Specification on alt may be helpful:
    http://esw.w3.org/topic/HTML/Action54AltAttribute

  8. Link Roundup: September 27- October 3, 2009 | meLISsa BLOG | Melissa Fortson Says:

    […] Clarifying ALT Text for WordPress Bloggers and Developers | Access Matters […]

  9. alan | Stooryduster Says:

    Thankyou. I’m about to use Comicpress as a theme for my cartoon site and was blaming the theme for the misuse of the alt attribute.

    Comicpress uses the title attribute as a deliberate hovertext element of the theme and the name of the file as alt text. Unfortunately the simplest solution for me was to add my alternative text to the title field and hack the php code to make the alt attribute also use the same data that is for the title attribute.

    Now I have a dilemma. The hover text adds value for sighted people just as the alt text adds value for the blind or partially sighted but using both as you say is irritating for those using accessibility devices.

    Any thoughts? Should I be ‘democratic’ and go with what will be the majority audience? Would the one’s using screen readers be understanding?

    Some think it perverse to add accessibility features to what is a visual web site (cartoons) but I like the whole idea that the web is multi layered. If you can communicate an idea, story or point of view visually effectively and with humour (comics and cartoons) then why can’t you also try communicating that idea verbally? It’s two different methods and work in entirely different ways but it’s worth a try.

    Which brings me to you describing the alt attribute as a description of the image. The alt attribute is an alternative (it provides another possibility (of understanding)) of the image. The example most people use is of a company logo image. Using ‘Image of our company logo’ would describe it well. Using ‘Company name’ alone doesn’t but does exactly the same job as the company logo image is doing.

    The way I was taught to test it out was to display the web page as text only. Then read it aloud to yourself and if the alt text fits smoothly into the flow of words with not even a hint of interference then you have done it well.

  10. Bob Easton Says:

    Good for you; trying to be sensible about accessibility.

    Here’s a suggestion for you. For the blog theme, editing the PHP is OK. For images that you add as posts, you can have your cake and eat it too. Here’s how. After adding an image to a post, (still in the post editor), click on the image and hit the Edit link. You will find several tabs. On one you can change the “Title” to be the text you want to appear on hover. On the Advanced tab, you can change the Alternate text. A lot of people duplicate this text, and that is minimally OK. It’s better to have each be suited to its purpose though. Most blind people configure their screen readers to not announce title text because of the repetition. That reduces annoyance and works very well for sites that have really good alternative text.

    Thanks for stopping by, and for putting extra effort into accessibility.

  11. alan | Stooryduster Says:

    Thanks for the reply I’m still hacking my way through the jungle. I’ll post the url once I have the site working to my satisfaction.

    Cheers

  12. Kevin Irvin Says:

    Great looking boats. I will look into them.

  13. Michael Says:

    Oops:

    I think WP Version 2.9.2 mostly solves this. It is still awkward and unintuitive, and silly, but if you fill out the
    TITLE
    Alternate Text
    Caption

    You get something like this when you view the page source later:


    alt="Cherry tree" width="240" height="133" />Photo credit: http://flickr.com/photos/katmere

    What do you think of that?

  14. Tyler Young Says:

    i host 5 of my blogs on Blogspot and it is really good for beginners. but if you want something with more features, nothing beats wordpress’”;

  15. Autumn Washington Says:

    I love those large German Shepherd dogs and also those tiny Chihuahua;,:

  16. Megan Thompson Says:

    i am not a fan of having credits and getting credits cards.*~’

  17. Libby Murray Says:

    i am saving money for my retirement because i want to enjoy most of my time as an old man.~~,

  18. Niamh Carter Says:

    as for my retirement, i plan to retire on an asian country and live a quiet and simple life.’,;

  19. alonso martiecoz Says:

    i love wordpress, it’s very easy for me to use

  20. miguel antonio ramos Says:

    very nice, i’m considering using wordpress soon.

  21. William Moore Says:

    China is one big country that does not even respect international copyrights *:-

  22. Caroline Bryant Says:

    i always want to have a very good credit record but due to recession, that changed~*,

  23. Nathan Rodriguez Says:

    i love dogs and puppies because they are very very cute-:~


Leave me your comments

Enter Your Details:


You may write the following basic XHTML Strict in your comments:
<a href="" title=""></a> <acronym title=""></acronym> <abbr title=""></abbr> <dfn title=""></dfn> <q></q>
<blockquote cite=""></blockquote> <cite></cite> <code></code> <kbd></kbd> <strong></strong> <em></em>

  • Your mature and responsible replies are greatly appreciated by all. Thank you.
Enter Your Comments: