Web accessibility myths

There is a lot of good advice for the discerning web developer to find on the web on how to make a website accessible, unfortunately there is also plenty of bad or outdated advice out there as well. Here are a few of the myths of accessibility that you may hear.

Validation equals accessibility

Good markup is the foundation of a usable, accessible and robust website. Testing that the HTML (and CSS) that you write passes a validation test can be very useful, and in general validity is something to strive for. As my colleague (and true accessibility genius) Benjamin Hawkes-Lewis puts it, valid code is a contract between you and the browser vendors – you write valid code, they will render it correctly (in theory!).

But this is not the same as accessibility, validators do not check that alt attributes are relevant, or that link text is useful. They do not test page interactions to ensure that they are usable by all. They do not ensure that text is readable. All of these issues are more important than validation, and given a choice between accessibility and validation, accessibility should win every time. Sometimes it is necessary to ignore the specification altogether, and write invalid code. Learning when and why is something that requires experience and knowledge, along with much testing when the time come, but don’t let the idea that invalid markup is always bad put you off.

If it works with a screen reader it is accessible

I think the majority of developers and their clients have got passed the idea that visual impaired people do not use the web, however there is so much focus on screen reader users that it is easy to forget that there are other groups of users that we need to make the web accessible for.

Fortunately over the last year I have seen much more information and new tools made available for opening up the web for many more people, from YouTube’s automated captioning of videos to the interest shown at events like Standards.next with a focus on cognitive disabilities. I hope this continues.

Sites are either accessible or inaccessible

Accessibility is very subjective, even by comparing against guidelines such as WCAG 2.0 it isn’t really possible to grade how accessible a website is. Content that is highly accessible to a visually impaired user with a screen reader may be inadequate for a user who lacks fine motor control.

The point is that there is almost always room for improvement, and that it is worthwhile making small changes that improve the user experience for only a small number of people – every little bit helps.

Content that isn’t 100% accessible shouldn’t be published

There is a growing trend of criticising any content that isn’t accessible to everyone, and this is counter-productive. The web has thrived and become what it is today because it is easy to publish to, by almost everyone. We might hope for more accessible content on the web but we must not discourage publishers, for example while there is no doubt that captioning of YouTube videos is a great boon to many people I would not like to see the pressure to caption put anyone off uploading a new video. Authoring tools and automation are the key for helping small publishers and non-developers make their content accessible, and we shouldn’t criticise the author if the available tools are inadequate.

The pressure seems particularly great on developers, who apparently should be held to higher standards. Christian Heilmann mentioned this in conversation recently, talking about how developers avoid putting slide decks of presentations they have online because they are not in an accessible format. This is a situation that benefits no one.

I believe that open content that is inaccessible to 50% of people is better than content that is never published. Ideally it is published with a license that allows others to take it and convert it to different forms which may be accessible, but this isn’t possible if it only exists in a file on someone’s desktop.

In conclusion…

I guess the theme of this post is that accessibility isn’t a target to aim for, it is a goal to aspire to. There is always something that can be more accessible, always another scenario that you have yet to consider, so release that application, publish that article, do your best the first time around and learn from mistakes when things don’t go well.

Alt attributes

Alt attributes are used to provide alternate text for non-textural HTML elements, most commonly on img elements. Generally their use is quite straight forward, but it is important that the attribute value you use is appropriate to the situation. In this post I’m going to talk about a few different use cases.

Let’s start the W3C description from the HTML 4.01 specification:

Several non-textual elements (IMG, AREA, APPLET, and INPUT) let authors specify alternate text to serve as content when the element cannot be rendered normally. Specifying alternate text assists users without graphic display terminals, users whose browsers don’t support forms, visually impaired users, those who use speech synthesizers, those who have configured their graphical user agents not to display images, etc.

The alt attribute must be specified for the IMG and AREA elements. It is optional for the INPUT and APPLET elements.

While alternate text may be very helpful, it must be handled with care. Authors should observe the following guidelines:

  • Do not specify irrelevant alternate text when including images intended to format a page, for instance, alt=”red ball” would be inappropriate for an image that adds a red ball for decorating a heading or paragraph. In such cases, the alternate text should be the empty string (“”). Authors are in any case advised to avoid using images to format pages; style sheets should be used instead.
  • Do not specify meaningless alternate text (e.g., “dummy text”). Not only will this frustrate users, it will slow down user agents that must convert text to speech or braille output.
    play terminals, users whose browsers don’t support forms, visually impaired users, those who use speech synthesizers, those who have configured their graphical user agents not to display images, etc.

So in HTML 4.01 an image always requires an alt attribute, but sometimes the appropriate value may be nothing at all if the image is purely decorative, a delimiter between links which are already in a list for example. Ideally these should be moved to our presentation layer, CSS, but in the real world it is not always possible to avoid having some decorative images in markup.

Some images repeat content which is available in another form. Let me give you an example:

My dog is called Milly. She is a Cavalier King Charles Spaniel, black and brown in colour,
with a white stripe on her chin.
<img src="http://farm4.static.flickr.com/3200/2730900277_54aa8dbeda_m.jpg" width="240" height="180"
alt="Milly has a white stripe on her chin">

In this example I have described Milly and provided an image to draw attention to one of her features, a small white stripe on her chin. Both the text and the image alt attribute make reference to the stripe, but remember that alt attributes are a replacement for images, so all we are doing is repeating what has already been said. There are no circumstances that I can think of where you would deliberately write ‘..with a white stripe on her chin. Milly has a white stripe on her chin.’

Let’s try this again:

My dog is called Milly. She is a Cavalier King Charles Spaniel, black and brown in colour,
with a white stripe on her chin.
<img src="http://farm4.static.flickr.com/3200/2730900277_54aa8dbeda_m.jpg" width="240" height="180"
alt="">

There is no need to have anything other than an empty alt attribute value as the meaning of the image is conveyed in the associated text. Without the text the image doesn’t make it clear what point I am trying to make – it is only a small white stripe after all. With the image sighted users will get additional information that is difficult to convey in words alone. It is advisable to write text which describes important images in this way rather than including the content in alt attributes so that all users benefit from the description and can easily read what you point you are making even if it is not immediately obvious to them from the image.

There is a different rule for images which are the only content of a link. Links must contain textual content, so an image on its own inside a link must have an alt attribute value. In these cases both the image and the alt attribute text should describe the target of the link.

Let’s try this one more time:

My dog is called Milly. She is a Cavalier King Charles Spaniel, black and brown in colour,
with a white stripe on her chin.
<a hef="http://www.flickr.com/photos/ipouncey/2730900277/sizes/l/">
<img src="http://farm4.static.flickr.com/3200/2730900277_54aa8dbeda_m.jpg" width="240" height="180"
alt="Larger image of Milly"></a>

Here the img links to a larger version of the same image and so we write alt attribute text to explain this. The main text still describes the image so all users will understand the purpose of displaying the image, and the content of the image (a picture of Milly) suggests what the link points to. If for some reason the image is not displayed, or the user uses screen reader software, the link will still make sense.

As for the other elements which allow alt attributes you can follow the same rules – treat area elements and input elements of type=image as you would an image which is the only content of a link, and applet elements as a regular img element.

Although these guidelines seem simple, correctly describing content can make a substantial difference to usability and accessibility so it is worth spending a little time to decide on the most appropriate text for alt attributes.

Title attributes

In many articles and blog posts on web accessibility use of the title attribute is promoted. Unfortunately this isn’t the magic bullet that many developers think it is, and I will argue for its use as a last resort.

First let’s see what the HTML 4.01 spec has to say:

This attribute offers advisory information about the element for which it is set.

Values of the title attribute may be rendered by user agents in a variety of ways. For instance, visual browsers frequently display the title as a “tool tip” (a short message that appears when the pointing device pauses over an object). Audio user agents may speak the title information in a similar context. For example, setting the attribute on a link allows user agents (visual and non-visual) to tell users about the nature of the linked resource.

Sounds like it might be quite useful. The specification gives an example of its use:

<a href="http://someplace.com/neatstuff.gif" title="Me scuba diving">
   me scuba diving last summer
</a>

Here we start to see the problems in the way it is used. Very often a title attribute on an anchor repeats information that is already contained in link text. Supposing that the title text is read by a screen reader what additional information does it provide? Little to none in this example, and unfortunately in most other examples I have seen.

Of course just because it is used badly in an example (and in most places that it is found in the wild) doesn’t prevent it being useful in other cases. What does is the way user agents deal with title attribute values.

As the specification says title attributes are most commonly displayed in user agents (web browsers in most cases) as tooltips, but only on hover with a pointing device and not on keyboard focus. If you are a keyboard only user with a visual user agent then it is very likely that you will not see a single title.

Even if you use a mouse or other pointing device there is a good chance that you will not see title attribute content as there is no visual indication that there is content to find, so unless you are in the habit of hovering over every element on a web page just in case a title attribute is set they will often be missed. Links are the most common place to find title attributes, but even then a user has to hover over a link for a second or two before the tooltip appears thus limiting their discoverability.

What about for users of screen readers then? Sadly they fair no better. As Jared Smith of WebAIM said in a comment on a recent accessibility tips article

…the title attribute is VERY rarely read on links. Screen readers have an setting to read the screen text (the blue underlined text inside the link), the title attribute, or the longer of these two. The default is screen text and I’ve only very rarely seen users change this so that the title attribute is read. So, while it’s OK to use title attribute to provide additional advisory information (that’s what the HTML spec says title is for), do not rely on it for accessibility and don’t count on it ever being seen or read by a screen reader.

So title attributes aren’t very useful then, but does this mean they are harmful? In my opinion they can be because they give the impression to developers that their use can make content more accessible to users and this simply isn’t the case. Often I see title attributes being used to cover up for inadequacies in regular content, for example:

<a href="#" title="Information about XYZ">click here</a>

The issue here is that the link text does not provide sufficient information about the destination when it is not in its full context. The solution is to fix the link text, not to add a title attribute.

An example of an appropriate use of the title attribute is given in the Techniques for WCAG 2.0 document when it offers the following advice about using title attributes on input elements:

  • User agents will display a tool tip when the mouse hovers above an input element containing a title attribute.

  • If no label is available, JAWS and Window-Eyes speak the title attribute when the form control receives focus

    • JAWS 6.0 and later can be set to speak both label and title when the two items are different; however, very few users are aware of this setting.

    • WindowEyes 5.5 has a hot key, ins-E, that will display additional information, including the title attribute, for the item with focus.

I have one criticism of this advice however, and that is that it doesn’t make it clear that this is a technique of last resort. In a situation where a label cannot be accommodated by the visual design first consider the possibility that the visual design might be flawed rather than immediately use this technique. As with links title attributes on input elements are not displayed on keyboard focus, and only after delay on mouse hover. While for many users the layout may provide sufficient context from which to derive the purpose of an input element add a screen magnifier to the mix for a keyboard only user and we are back to content that is obfuscated. If it is possible to accommodate a label for each input element in a design then do so rather than use a title attribute.

In conclusion, whenever you are thinking of using a title attribute think carefully about whether this is the right approach – more often than not you will find that by changing your content the problem, and the need to use title, goes away. If you can find no other alternative then understand that there is no guarantee that content in a title attribute will be available to your users.

Update

There are a couple of comments that deserve a response.

As Jared points out the key phrase in the HTML specification is ‘advisory information’, however I think it can be difficult to determine what is advisory and what can, for some users, turn an unusable interaction in to a usable one. In my opinion the safest option is to assume that any potentially useful content is useful, and sometimes necessary, to all users and where possible to display it by default. Sometimes a tidy design which otherwise improves the user experience doesn’t allow for advisory information, in which case use of the title attribute is a possibility, but as I say in the post it should perhaps be a last resort. The same can apply to any situation were you want to visually hide content, for example to make it available only to screen readers by positioning it off screen – it is a great technique but be sure to understand the consequences before using it.

Thierry mentioned the problems screen magnifier users can have with title attributes. The focus of this post was how unreliably content in title attribute values is made available to users, but he is right to point this out. The issue is that when a title attribute is displayed as a tooltip it covers, and can obscure, other content. With a screen magnifier a smaller area of the page is visible at a time, the tooltip will cover a larger proportion of the visible area than normal, and can therefore get in the way that much more.

Goodbye 2009, hello 2010

Now that 2009 is over and done with and 2010 is here it seems a good time to take a look at what I got up to in the last 12 months and what I plan to do in the next 12.

1 year ago I wrote that I was hoping to average a post a week on this blog. How did I do? Well, terribly actually, making only 7 posts. This year I’m going to make a similar commitment, but instead of averaging a post a week (which let me off the hook somewhat because in theory I could always publish lots of posts late on to take the average to 52) I will try to post each week. Starting with this one. For a bit of extra motivation I’ve signed up to Project 52, which is a list to sign up to if you want to make the same commitment. I have to admit I’m not really a fan of forcing blog posts to a schedule like this as it can easily promote quantity over any measure of quality, but I really want to improve my writing ability in 2010 and I feel that writing lots is a good starting point. It will at least give me a body of work to review when looking for ways to improve. Even poor quality content is better than no content at this stage.

Professionally 2009 was an exciting year for me. Metro, the latest version of the Yahoo! homepage was launched. This is by far the biggest project I have ever worked on, and quite likely ever will. It has taken close to 2 years of my working life. While not perfect I’m quite proud of what we have made. As one of the people responsible for the accessibility of the page I am particularly pleased. With such a complex project (even if it is only one page) it is difficult to get everything right, particularly when there are other competing factors such as performance, but I think that overall it is in good shape, and will hopefully be improved over the coming months as we get more user feedback and peform further testing.

Working on Metro led to my first published article in an international web development magazine, a short piece about WAI-ARIA enhanced tabs in issue 195 of .net magazine. This was part of a wider article on the build process and implementation of Metro, and was followed up with a post on the YDN blog.

Also in 2009 was my first speaking gig at the fantastic Standards.next event on the subject of cognition and accessibility. While I was incredibly nervous to start with I think my presentation went well, and I really enjoyed it. Many thanks to Henny Swan and Bruce Lawson for giving me the opportunity. It is something I would like to do more of in 2010.

On the downside more good friends have left the London office of Yahoo!, either to work in the Sunnyvale head office or to other companies. All are doing well though, and I will be staying in touch.

Outside of web development not much has changed for me in the last 12 months. I’ve been looking to buy a flat in North London for most of the year, without much success. I had an offer accepted on one flat but that was then taken off the market the following day. The year was been rounded off with an epic 19 day holiday, which sadly ends on Sunday. I’ve spent most of this time with my family in Neston, Cheshire, with many lazy mornings and walks with my dog Milly. I was hoping to be rather more productive than I have been, but it has been nice to take a break. It’s going to be tough going in to work on Monday morning, but I’m looking forward to seeing work colleagues and friends again.

One highlight was being best man for my good friend Marco van Hylckama Vlieg when he married Pam. It was an honour to be involved. In September they welcomed their son Elijah Rhys van Hylckama Vlieg in to the world, so that gives me another excuse to visit them in Calafornia sometime in the next year or so.

For 30 minutes on a September morning I helped out with fundraising for the Royal National Institute of Blind People on Paddington Station. I would have liked to have spent longer there but I had work to go to. What surprised me most is how much fun it was and how generous the British public can be. I’m not usually the sort of person who would stand in a busy main line station trying to persuade commuters to part with their cash, but I soon got in to the swing of it. I heartily recommend it to anyone with a bit of spare time. Take a look at the RNIB collections page if you decide to give it a go. I have to admit to being slightly conflicted though – in general I don’t give to collections in pubs, supermarkets and stations, preferring to decide who I give my money to on a more selective basis than who waves a tin under my nose first. I have given to the RNIB in the past though, and no doubt will in the future, so I was happy to ask others to do the same.

So, what do I want to get out of 2010?

Education and sharing of knowledge is increasingly becoming important to me so I’d like to do more speaking, at Barcamps at least, and hopefully at some bigger events if people are interested in what I have to say.

I want to write more, and this blog is where I’m going to start with that.

I will continue the flat hunting, and will hopefully have a bit more luck than last year

As usual I want to lose some weight – I’ve done it before and can do it again. I just need harness a bit of will power. And maybe stop eating so much and start getting some excersise. I think the key to this is to get back in to martial arts, I’m just not sure which one. I’d love to give Sambo a try, but there are no clubs near where I live. Brazilian Jiu-Jitsu is another possibility, or maybe I should go back to Judo or traditional Jiu-Jitsu. Aikido is yet another possibility, but I’m in two minds about it at the moment.

I’d like to meet up with some more of the people I follow on Twitter, in particular members of the web accessibility community who are doing such great work.

I also want to spend more time with offline friends as well. I have a bad habit of isolating myself in the evenings and at weekends. This is partly due to my terrible sleep patterns, but is also part lazyness and a dislike of having my schedule outside of work too tightly constrained.

I bought a guitar about 2.5 years ago now, it might be time to learn how to play it. Also I want to get back in to playing bass guitar, something I’ve been missing for a while. I’m a little fed up of soldering bits back on to my current (and first) bass so I should probably invest in a new one.

Hopefully I’ll be a little more successful in achieving these goals, which I refuse to upgrade to the status of resolutions, than last years single goal. Check back in another year (sooner would be nice as well) if you want to see if I have.

Happy New Year, I hope 2010 is a happy and prosperous one for you.