Javascript and Accessibility: introduction
| |
Print |
Send |
Share |
Warning: the original version of this document is Creating Accessible JavaScript: Overview . This French translation was done by Ideos under an agreement between WebAIM and Ideos .
Note: See page documents on web accessibility for a list of all translated documents. Other resources on web accessibility are also listed in the digital portal accessible .
Summary
- You are on Page 1: Introduction
- Page 2: JavaScript event handler
- Page 3: Other issues of accessibility of Javascript
- Page 4: Alternatives to JavaScript
- Page 5: Summary for accessible Javascript
Introduction to the JavaScript
It may be preferable to define what is NOT JavaScript.
First, the JavaScript does not use HTML tags and does not depend on the general rules of HTML.
However, you can use JavaScript with HTML on a web page.
Second, JavaScript is not Java.
Although JavaScript is often called Java, the two are different.
Java was developed by Sun Microsystems and is a complete programming language.
For its part, JavaScript was developed by Netscape Corporation.
Although similar to Java syntax, JavaScript is a programming language independent.
For the JavaScript function, it must be part of a web page that is displayed in a browser that understands JavaScript.
The Java programming language from Sun can be implemented in Web pages as an internal program, while JavaScript depend on the client computer (visitors) to work.
Once again, the JavaScript is not HTML or an HTML version. It is a separate scripting language. HTML is read and processed by the web browser. When the browser reads the JavaScript code in your HTML document, it executes the code and then displays all outputs within the web page. To view the JavaScript, the computer must have a JavaScript interpreter, a program that interprets and executes the script and the interpreter must be enabled.
When used alone, the HTML does is create static pages. Then there is little user interaction and little dynamic content within a page. HTML can not "think" it does not have the ability to perform mathematical variables to store or display content dynamically. JavaScript allows your webpage to "think". Although many programs on the server side scripts (such as PHP, JSP, ASP or ColdFusion) have the capacity to handle such functions, the JavaScript can perform these functions in the Web browser of the client. Because JavaScript is a scripting language, it allows developers to implement small applications within their pages. These programs can do things as simple as changing an image when the mouse flies over or something as complicated as the execution of mathematical formulas entered by the user.
The issues of accessibility JavaScript
JavaScript allows developers to add more interaction, more information processing and control of web content. However, JavaScript can also create accessibility problems. These problems include:
- Navigation. Inability or difficulty navigating by keyboard or by using an assistive technology.
- Hidden content. Presentation of content or feature is not accessible to assistive technologies.
- Control by the user. Difficulty of user control of automatic changes of content.
- Confusion / Disorientation. Changing or deleting the original features of a user agent (browser) or triggering events that the user is not aware.
A web page containing JavaScript is generally available if Javascript features are device-independent (does not work only with the mouse or the keyboard only) and information (content) is available to assistive technologies. Unfortunately, there is no easy solution to solve all the problems of accessibility related to JavaScript. The only way to ensure the accessibility of JavaScript is to assess each script and design an appropriate solution to every problem of accessibility met. Developers must be familiar with the issues of accessibility and JavaScript solutions to achieve one or two of the following:
- Make the JavaScript directly accessible.
- Provide an affordable alternative to JavaScript (not using Javascript).
The JavaScript that has no effect on accessibility
The fact that Javascript is used on a page does not necessarily mean that the page is inaccessible. In many cases, JavaScript can be used to increase accessibility. Additional information, warnings or instructions can be given to users through advertisements JavaScript (JavaScript prompt). For example, under Section 508 (Law United States), a user must be notified when a time limit for response is required and must have the opportunity to request more time. Such functionality would be difficult to do with HTML alone.
JavaScript is often used to create the visual interface elements that have no impact on accessibility. JavaScript is commonly used for images rollovers from which an image is replaced by another when the mouse is placed over the image (for example, when a navigation item changes to show a shadow, or a burst development when the user moves the mouse over).
Place your mouse over the image to see the following JavaScript example that does not affect accessibility.
Problems
No. In this example, any content or important feature is introduced by the Javascript. The change of image is purely decorative.
Solution
No additional technical accessibility is required.
Remember to put the image a text alternative (eg <img alt="Accueil"...> ).
This use of JavaScript does not need additional accessibility feature as no important content is displayed.
To open the JavaScript is to study the following questions. Each will be discussed in the following pages.
- When you manage events, use only those that are device independent (eg, those that do not only use the mouse or the keyboard only).
- Content and features that are provided by scripts must be made accessible to assistive technologies.
- Web pages that have scripts must be fully navigable with the keyboard.
- JavaScript should not alter or override an original functionality of a browser if it causes confusion.
- When the JavaScript can not be made natively accessible, an accessible alternative should be given (alternative not using Javascript).
Comparison of recommendations for JavaScript
The thematic elements of accessibility script is processed by both Section 508 of the Rehabilitation Act (United States) and the WCAG 1.0. They demand that the functionality and content of the scripts are accessible to assistive technologies like screen readers for example. In addition, users should have control over changes in time of content. However, there are differences between these two documents. WCAG request that the content and functionality are accessible with scripts disabled and users are notified if the JavaScript changes the appearance or functionality of the browser window, while Section 508 requires only that the script will be accessible or that an alternative access is given.
Conformance testing of JavaScript
As noted above, your web pages must be fully functional with JavaScript disabled. This is required under Priority 1 of WCAG 1.0. Section 508 does not require the page to work if JavaScript is disabled, but requests that the scripts themselves are natively accessible. This tutorial teaches strategies to make natively access your scipt and assumes that if you, as a developer you want to achieve a high level accessibility or to comply with WCAG, you should test your pages to make sure they work with JavaScript disabled.
Disable JavaScript
Follow the instructions to disable or enable JavaScript in your browser. You can also determine if JavaScript is enabled . Test your pages with JavaScript enabled and see if the content and functionality is available. Be careful to re-enable JavaScript when you have finished your test.
Internet Explorer 6.X
- Launch Internet Explorer.
- Select Tools> Internet Options.
- In the dialog box in Internet Options, select the Security tab.
- Click on the Custom Level button at the bottom of the window. The dialog box Security settings opens in a new window.
- In the Scripting category, enable / disable Active scripting, Allow paste operations via script, and Scripting of Java applets.
- Click OK two times to close the dialog box.
- Reload the page.
Firefox 3.X
- Launch Firefox.
- Select Tools> Options.
- Select the Content tab.
- Check / Uncheck Enable JavaScript.
- Click on OK.
- Reload the page.
Netscape 7.X
- Launch Netscape.
- Select Edit> Preferences.
- Click on the arrow next to Advanced.
- Click on Scripts & Plugins.
- Check / Uncheck the Navigator for "Javascript enabled".
- Click on OK.
- Reload the page.
Opera 7.X
- Launch Opera.
- Select File> Quick Preferences.
- Check / Uncheck Enable Javascript.
- Reload the page.
Commercial links
Copyright 1999-2009 WebAIM












![[Paris, December 6 2011] THE conference of the presidential campaign Web 2012 (Ideos / 2.0 Elect partner)](http://www.elus20.fr/images/pdffrance2011_elus20.jpg)























