Web Accessibility for the Apathetic
By Ed Johnson
If you’re like me, you approach the subject of accessibility with a certain self-conscious guilt. On the one hand, you recognize that there are excellent ethical and legal reasons for making your applications – be they web-based or rich client – accessible to those with sensory or cognitive impairments; but on the other hand you can’t ignore the fact that the extra work required to add that accessibility is only going to make a difference to a very small percentage of your users.
In recent years, the legal impetus has begun to gain strength, forcing those of us to action who might otherwise have been willing to put our internal ethics department on hold in the name of conserving time and energy. Having spent some time recently working inside a department of the Australian government, I have learnt that the issue of accessibility, in particular web accessibility, has a reasonably high profile. Because government web sites are required to adhere to accessibility guidelines1, there has developed a group, comprised of either moralists or opportunists, who spend their time scouring the web pages of government web sites looking for non-conformances to use as the basis for legal prosecution. American courts have recently ruled that the accessibility requirements pertinent to US governmental web sites are also applicable to privately held web sites. Even your blog counts as material that is made “publicly available,” and must therefore be equally available to all.
With these ideas in mind, and also to assuage my growing feelings of guilt regarding the accessibility (or lack thereof) of this site, I decided to undertake a bit of a site revamp, the cosmetic results of which you will already have noticed. This article provides a brief overview of the process I followed, and thereby gives a general introduction to the tools and techniques necessary to retro-fit accessibility to a site that was designed without specific consideration of that issue.
General Approach
In general, web accessibility can be achieved by adhering to the following two principles:
• SeparatepresentationfromcontentbyrestrictingyouruseofHTMLto the standard structural elements, and using CSS (Cascading Style Sheets) to control the way that structure is presented. • Emphasize textual content. Where non-textual content is used, always provide a textual equivalent. A good portion of the details appearing below are in support of these two principles. The steps below show you how to transform a non- accessible web page into an accessible one. Step 1: Ensure All HTML Elements Are Structural Structural elements those which describe the semantic units of an HTML document. Examples of structural HTML elements are: •
… •
•
-
•
-
• • Over the years, browser vendors have added proprietary non-structural elements and attributes to the HTML grammar their browser understands, in an effort to differentiate their product from their competitor’s. The result is a tag set which invites misuse, is interpreted differently (or not at all) in different browsers, and awkwardly combines content and presentation. By removing elements that specify some aspect of the document’s presentation, accessibility can be improved. Examples of non-structural HTML elements you should remove are: •
• • • • • • ••
•• The layout effects produced by these non-structural tags can, and should be, achieved with style sheets. Using these tags only pollutes your HTML document with presentation information that may well be useless or misleading to those with low vision. For instance, elements should be removed because bold text has no meaning to a blind user. This doesn’t mean that text can’t be made bold, but rather that CSS rather than HTML should be the means by which the bolding is achieved. Note that in some cases there is a structural tag that you should put in place of the deleted non-structural tag. For example: • If you have removed tags that were used to emphasize words, insert tags where the tags used to be. • Ifyouhaveremovedtagsthatwereusedtocreateaheading,insert a heading tag like
where the tags used to be. • If you have removed tags that were used to add emphasis, insert tags where the tags used to be. In other cases, there is no structural element already defined in HTML that adequately captures a structural aspect of your web page, so you must invent your own using the or
elements. For instance, you might create a of class “footnote” to denote footnote references: This is a footnote. The way that span elements of class footnote are displayed is later specified in a CSS. Step 2: Ensure All HTML Attributes Are Structural Non-structural attributes should be removed for the same reasons that structural elements should be removed. Examples of non-structural attributes you can delete are: • align • link • alink • halign • valign • background • color• text • bgcolor • vspace • height • width • hspace • border Again, all the layout effects that were produced by these attributes can be achieved with CSS, leaving the basic HTML document more accessible. Step 3: Remove Misused Structural HTML Elements Structural elements should not be used as ersatz layout mechanisms as this will confuse those accessing your web page with a text browser. Examples of the misuse of structural elements for layout purposes include: • Using empty paragraphs (
) to put a vertical space between consecutive blocks of text. • Usingthe
elementtoachievecolumnaralignmentofmaterial that is not inherently tabular. • Drawinglinesbystretchinga1-pixel
. • Using
purelytoachieveindentation. Step 4: Ensure All Non-Textual Content Has A Textual Equivalent Users with visual impairment may use a text browser, Braille bar or screen reader to access your web page. These mechanisms can only deal with text as input. So you need to supply a textual equivalent to any non- textual content on your web page. A common examples is using the alt attribute of
tags to describe the significance of the image. There are certain mechanisms which should be used sparingly, if at all, because they are inherently inaccessible. These include: • Imagemaps • Javascript • Side-by-sideframes • Secondarywindows • Shockwaveanimations Not only are these mechanisms difficult for some users to access, but they may be deliberately disabled by any user in their browser. Step 5: Add In Attributes Or Elements That Aid Accessibility There are a few HTML structural elements and attributes that are particularly helpful from an accessibility perspective: • The
and elements can be used to specify the expansion of abbreviations and acronyms when they first occur in a document. • The element should be used to identify column headers. Tables are linearized in text browsers, and knowing which table cells are headers helps the user interpret them. • In HTML forms, use the
-
•