ARCHIVED - Defining the JavaScript issue for accessibility
This information has been archived because it is outdated and no longer relevant.
Archived Content
Information identified as archived on the Web is for reference, research or recordkeeping purposes. It has not been altered or updated after the date of archiving. Web pages that are archived on the Web are not subject to the Government of Canada Web Standards. As per the Communications Policy of the Government of Canada, you can request alternate formats by contacting us.
Table of Contents
- 1.0 Know your audience
- 2.0 Accessibility scenarios
- 3.0 Do not assume...
- 4.0 Issues
- 4.1 Document.write
- 4.2 Window.status
- 4.3 Cursor position
- 4.4 JavaScript pseudo protocol links
- 4.5 DoubleClick event handlers
- 4.6 Pop-up windows / automatic opened windows
- 4.7 Drag-and-drop features
- 4.8 Tickers
- 4.9 Auto refresh feature
- 4.10 Forms without submit buttons
- 4.11 Links created with JavaScript or pointing to a JavaScript function
- 4.12 Event handlers
- 4.13 Error Messages
- 5.0 Source Documents
1.0 Know your audience
You should not assume that all clients are able to handle JavaScript. When elements of a page require JavaScript, those elements may not be accessible to clients who use computer equipment adapted to a disability or clients who have disabled JavaScript in their browsers for security or personal reasons. Additionally, screen-reading browsers, alternate browsers and text-based devices such as Blackberry, Web enabled phones, and PDAs will most likely display these elements incorrectly. You should provide equivalents to make the site usable when JavaScript is disabled.
2.0 Accessibility scenarios
Web developers have to consider three major accessibility scenarios when developing alternatives to JavaScript. They are:
Group 1: Mobility impaired clients with recent, standard browsers
Scripts created in an accessible manner *may* be usable.
Group 2: Visually impaired clients with recent screen-reader / standard browser combination
Scripts created in an accessible manner *may* be usable.
Group 3: Clients with older browsers, older assistive technologies, text-only browsers such as Lynx, or clients who have disabled scripts in their browsers
Scripts are generally not supported for clients in this group; any functionality provided by scripting will be inaccessible to these clients unless an alternative, non-scripted solution is offered.
3.0 Do not assume...
Never design and test with only the newest technology in mind. This is especially important with the technology that clients with disabilities use. It is also unacceptable to develop files that only clients who can afford to buy the latest technology can access. For example, JAWS (including system and software upgrades) can cost at least $1500.
4.0 Issues
4.1 Document.write
Screen-readers such as JAWS will not read text updated with document.write. Additionally, document.write will incorrectly update browsers such as Lynx. You have to find another way to design your site.
Groups affected: group 2 and group 3
4.2 Window.status
The status bar of certain browsers provides additional information to the client when the cursor is placed over a link. You can control the information that appears in the status bar by using window.status. Browsers such as Lynx will not read text updated or created using window.status. Additionally, if you update the status bar repeatedly, clients who use a screen-reader will find it difficult to navigate and the page may become unusable. Do not use the status bar to convey additional information. Instead, use the title attribute and make sure that links make sense when taken out of context.
Groups affected: group 2 and group 3
4.3 Cursor position
If you use a script that relies on the co-ordinates of the cursor, consider how clients using a keyboard will emulate this activity. If a keyboard can't be used to emulate an activity, find a different solution.
Groups affected: group 1, group 2, and group 3
4.4 JavaScript pseudo protocol links
You should avoid the JavaScript pseudo protocol because it is not considered accessible. Clients don't always enable JavaScript or their browser doesn't support it. Also, a number of JavaScript capable browsers do not support pseudo protocol. Screen-readers such as JAWS will not understand pseudo protocol links while browsers such as Lynx will update incorrectly. You have to find another way to design your site. Below is an example of a JavaScript pseudo protocol link.
<a href="javascript:window.open('fred.html',' windowname','height=100')">Fred</a>
Groups affected: group 2 and group 3
4.5 DoubleClick event handlers
Currently, device-independent or keyboard-equivalent event handlers are not available for the doubleClick event handler.
Groups affected: group 1, group 2, and group 3
4.6 Pop-up windows / automatic opened windows
There are other ways of conveying information than through pop-up windows. CLF standards strongly discourage pop-up windows because they are not considered accessible. If you have to use pop-up windows, you have to warn clients before a new browser window opens. You also have to inform clients when they are in a new browser window.
Groups affected: group 1, group 2, and group 3
4.7 Drag-and-drop features
Most clients with a disability can't use drag-and-drop features unless a similar keyboard-driven feature is provided.
Groups affected: group 1, group 2, and group 3
4.8 Tickers
Tickers are segments of scrolling text on the screen. They are often used to deliver stock quotes and weather information. Tickers have to be a feature that clients enable themselves as they can draw the focus away from the area of the site that clients are trying to read. This means that the client's focus will move repeatedly toward the scrolling text resulting in the site being impossible to use.
Groups affected: group 1, group 2, and group 3
4.9 Auto refresh feature
Set the auto refresh feature so that clients have to enable it themselves as it can draw the focus away from the area of the site that clients are trying to read. This means that the client's focus will move repeatedly toward the scrolling text resulting in the site being impossible to use.
Groups affected: group 1, group 2, and group 3
4.10 Forms without submit buttons
JavaScript is often used to update or to submit information. The onChange event handler is frequently used in select boxes for calendar-type pages. As they are not considered accessible, do not use the onChange and onSelect event handlers in select/combo boxes.
Groups affected: group 1, group 2, and group 3
4.11 Links created with JavaScript or pointing to a JavaScript function
Most screen-readers are unable to handle links created with JavaScript or that point to JavaScript functions. Also, clients with browsers that do not support JavaScript or with JavaScript disabled can't use these types of links. Avoid using links created with JavaScript or links pointing to JavaScript functions.
Groups affected: group 1, group 2, and group 3
4.12 Event handlers
JavaScript is often used to process events on a Web page. Event handlers must be entirely mouse-independent. Use device-independent event handlers or pair mouse-based event handlers with keyboard-based ones. The functions that use these event handlers must not impede or obstruct client navigation.
The most common error involving event handlers is using submit buttons that call JavaScript functions to validate and/or submit data. JavaScript event handlers will function incorrectly with older browsers, older assistive technologies, text-only browsers such as Lynx, or browsers with JavaScript disabled.
Groups affected: group 1, group 2, and group 3
4.13 Error Messages
Pop-up windows are extremely disorienting for clients who use a screen-reader. Clients with a visual impairment may not receive an error message for a form if the error message is on a separate page (pop-up window) as the screen-reader will not read it. If the error message is on a separate page, clients are unable to receive the additional information provided on that page as they are often locked into a field.
Additionally, when clients finish reading a pop-up window, the focus will be returned to the beginning of the original page. This means that clients have to navigate through the entire page to find where the error is occurring. It is better to re-display the form with the error message embedded as it is more convenient for all clients.
If you have client-side form validation (using JavaScript or other methods), you also need to have server-side form validation installed for clients who have problems with scripting, who don't have scripting support, or who have disabled scripting.
Groups affected: group 1, group 2, and group 3
5.0 Source Documents
- [508] "Guide to meeting requirements of 508 with regard to JavaScript"
- [IBM] "Techniques for Scripts"
- [National Cancer Institution] "508 Tutorial (l): Scripting"
- [Snow] "JavaScript and Accessibility"
- [SW Missouri State University] "checkpoint Scripting"
- [Trace] "JavaScript Accessibility Project"
- [Tom Gilder] "Accessible Scripting"
- [EC:ACT] "Accessibility Fieldguide"