Mandatory alt attribute is insignificantSaturday, February 07, 2009
I don't care whether the
alt attribute is mandatory or optional in HTML 5. I care about developing accessible websites that delight my visitors. I won't be prevented from doing this if the
alt attribute becomes optional.
alt attribute on an image is the most widely recognised accessibility hook in the entire HTML syntax. It allows the author to provide a text-equivalent to the content of the image. Previous versions of HTML have made this attribute mandatory, and the 'next' version, HTML 5, is considering making the
alt attribute optional.
Does it matter?
John Foliot claims that making the
alt attribute optional makes teaching accessible web development more difficult because the HTML Recommendation won't back up his claims that
alt attributes are essential to accessibility. His main point is that the
alt attribute is the key cornerstone of proof that the web isn't just a visual medium, and that non-visual criteria should also be considered when building websites. By making the
alt attribute optional waters down this principle.
It is a fair point to consider, but the underlying basis of the point isn't right. The flexibility of building a website that can be rendered in non-visual manners isn't a reason to compel others to build a site in this fashion. The
alt attribute can encourage a consideration of non-visual renderings when the developer is keen to build a site to the best of his abilities. But it is not because the
alt attribute is mandatory, it is because the developer is enlightened.
The other typical argument is that without a mandatory
alt attribute developers won't bother putting one in and, for example, a screen reader's fallback is to use heuristics to generate (or perhaps guess) a replacement text equivalent. For many sites this results in gibberish, which means the site may have accessibility barriers.
The question is whether accessibility should be a mandatory requirement in the HTML5 recommendation. I don't consider the HTML5 recommendation to be an acceptable place to define and scope the social and civil rights of disabled people. It should define the technical munitae of the Hypertext Markup Language and not be an education piece on web authoring best practice.
Gaining accessibility experience
When I was learning the tools of my trade having the
alt attribute as mandatory did not make a blind bit of difference. At first I didn't fill it in because validation was just an academic exercise back then. When validation became a useful tool and I was forced to enter an
alt attribute on my images the quality of those text-equivalents weren't great. Many times, it was just a null
alt="") just to satisfy the validator, and prevent the tooltips appearing.
Then I learnt about web accessibility and I went back to those images and patted myself on the back because I already had
alt attributes, therefore my site was accessible without me having to do anything.
I was wrong. So badly wrong.
At a certain point, when it dawned on me that accessibility is about the civil rights of disabled people to be a part of society (and not about technology and specifications); I realised that the presence of the
alt attribute was not the end, but only the means to an end. What I realised was that the utmost important point was that the core content entombed in an image must also be present in a text-equivalent manner. It is the presence of an adequate text-equivalent that is key; the
alt attribute merely provides one way to incorporate that text-equivalent.
Part of the difficulties of web accessibility is the continual unlearning and missteps. One of the
starting steps on the accessibility ladder is the fanatical devotion to valid HTML and delivering XHTML with the correct mime-type. Later steps involve understanding how orthogonal that is to web accessibility, and so we have to unlearn that instinctive habit as the exceptions surface. And we learn sometimes the most accessible way is to use invalid HTML.
Looking at my learning path through web accessibility I see a path of revolution, not evolution. Moving forward with a deeper understanding meant rejecting previous firmly-held beliefs. Remember when Betsie and Bobby were heralded as a major accessibility breakthough? Now they're scorned out of existence.
alt attribute didn't make my sites accessible. Bobby didn't make my websites accessible. Betsie didn't make my websites accessible. CSS layouts didn't make my websites accessible. Rejecting Flash didn't make my websites accessible. Delivering XHTML with application/xhtml+xml didn't make my websites accessible. Using em-based layouts didn't make my websites accessible. Inserting text-resize widgets into my site didn't make my websites accessible.
Geniune Accessibility learning
The fundamental principle that disabled people have a right to be a part of society, and understanding the barriers they face online, that's what made my websites accessible. Empathy and the willingness to help; that's the cornerstone of web accessibility. An alt attribute, mandatory or optional, is just one technique in an ever-increasing toolbox.
For real guidance about web accessibility consult the Web Content Accessibility Guidelines 2.0. This document should be read in conjunction with any other web-orientated specification, and it's advice trumps all technical documents when it comes to web accessibility. (Unless you know more about web accessibility than the Web Accessibility Initiative.)