Back to the original French page Read this page in Italian by Google Translation Read this page in Portuguese by Google Translation Read this page in English by Google Translation Read this page in German by Google Translation Read this page in Spanish by Google Translation Read this page in Arabic by Google Translation Read this page in Hebrew by Google Translation

Synthesis for accessible Javascript

Go to the beginning of the content without using the bar Consultation and Sharing How to use the bar Consultation and Sharing Listen to the main content of this page
Print Print the main content of this page Send Email the main content of this page Share Share on TwitThis Share on Facebook Share this page on Wikio Share this page on Google Share on LinkedIn Share on Digg Share this page on del.icio.us Share this page on Netvibes

Warning: the original version of this document is Creating Accessible JavaScript: Accessible JavaScript Summary . 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 .

Overview

JavaScript allows developers to add more interaction, information processing and control web content. JavaScript can also create accessibility problems, limiting the navigation via keyboard or assistive technology, presenting content or functionality that is not accessible to assistive technologies, limiting control by user content changes automatically and modifaint native functions of the browser. When you are confronted with issues of accessibility of JavaScript, you must do one of the following:

  • Make sure that the JavaScript is directly accessible.
  • Provide an alternative non-JavaScript accessible.

JavaScript is often used to make decorative changes or other changes to the content that do not affect accessibility. Generated content in a page by JavaScript is available if:

  • event handlers independent devices are used.
  • content and features created by JavaScript are accessible to assistive technologies.
  • elements and pages with scripts are navigable with the keyboard.
  • the native browsers are not changed in a way that may cause confusion or inaccessibility.
  • an accessible alternative is given when the JavaScript can not be made natively accessible.

JavaScript event handlers

There are two types of JavaScript event handlers - those who are dependent on devices and those who are independent. When you implement event handlers, you must use an event handler or device-independent event handlers use multiple dependent devices to accommodate all users. Here is a list of event handlers and their accessibility problems.

onMouseOver and onMouseOut
Dependent on a device (requires the use of the mouse).
Make sure no important content or functionality is introduced by this event handler.
Use event handlers with the onFocus and onBlur to allow access to the keyboard.
Provide an accessible alternative if the content or functionality can not be made natively accessible.
onFocus and onBlur
A device independent (works with both the keyboard and mouse).
Experiment to verify that accessibility is not affected.
onClick and onDblClick
Dependent on a device (requires the use of the mouse).
onClick is activated by a keyboard input when used with links and form fields.
There is no equivalent independent devices or keyboard accessible to these event handlers.
Functionality and content provided by the event handler onClick should also be made ​​available.
onChange and onSelect
A device independent (works with both the keyboard and mouse).
Functionality and content provided by the event handlers onChange and onSelect should also be made ​​available.
The elements of a drop-down menu navigation that are triggered by onChange are not fully accessible to the keyboard.

Dynamic HTML and accessibility

Dynamic HTML (DHTML) is usually a combination of CSS and JavaScript. By nature, DHTML can have a dynamically changing content. DHTML is often triggered by user interactions such as mouse movement. When you implement DHTML, you must ensure that the DHTML is triggered independently from one device and the content or functionality provided by the DHTML is also available.

JavaScript can also be used to write dynamic content to a Web page. In most cases, the content is accessible unless the content is constantly changed or that interferes in one way or another with the accessibility of the page.

Pop-up

The default behavior of the browser and HTML elements may also be affected by the JavaScript. The pop-ups can be triggered by JavaScript or JavaScript event handlers. If the user is not notified that the pop-up window opens, it may be disoriented by the abnormal behavior of the Web browser. Changing the browser windows to remove the scroll bars, status bars, menus or toolbars can also create accessibility problems. Use the pop-up with care and when used, always alert the user. The user should also be alerted when JavaScript is used to automatically perform the functions of the native web browser, such as redirecting the page refresh or auto-scroll. In any case, you have to user testing and testing with assistive technologies. This can provide valuable information regarding the accessibility implementations of JavaScript.

Alternatives to JavaScript

There are many ways to provide alternatives to JavaScript. New versions of CSS can recreate much of the JavaScript behaviors using only CSS. The navigation menus, navigation bars, and all image maps can be developed without relying on JavaScript. However, the implementation of CSS in browsers and assistive technologies differ and may cause problems. When the JavaScript itself can not be natively accessible, you must provide an accessible alternative. This can be done by replicating or replacing the JavaScript behavior with a server-side script. You can also give content in a tag <noscript> that is available when JavaScript is disabled or when it is not available for the end user.

Standards and recommendations

Standards and recommendations apply to JavaScript:

Section 508 of the Rehabilitation Act Law § 1194.22 (U.S.):

  • (L) When pages utilize scripting languages ​​to display content, or to create interface elements, the information provided by the script shall be identified with functional text that should be read by the technologies of assistance.
  • (N) When electronic forms are designed to be completed online, they must allow people using assistive technology to access information, elements and functions necessary to fill them and send them, including all advice and guidance.
  • (P) When a timeout is required, the user must be aware and have enough time to request more time if necessary.

The W3C WCAG 1.0:

  • 6.3 [Priority 1] Ensure that pages are usable when scripts, applets and programmatic objects are disabled or not supported. If it is not possible, provide equivalent information on an alternative accessible page.
  • 6.4 [Priority 2] For scripts and applets, ensure that event handlers are independent of the material.
  • 6.5 [Priority 2]: Ensure that dynamic content is accessible or provide an alternative presentation or page.
  • 7.4 [Priority 2] Until user agents provide the ability to stop a refresh, do not create pages that automatically refresh themselves periodically.
  • 7.5 [Priority 2] Until user agents provide the ability to stop auto-redirect, do not use markup to redirect pages automatically. Instead, configure the server to perform redirects.
  • 8.1 [Priority 1 if functionality is important and not presented elsewhere, otherwise Priority 2.] Make programmatic elements such as scripts and applets directly accessible or compatible with assistive technology.
  • 10.1 [Priority 2] Until user agents allow users to disable the windows "surge" does not create a "pop-ups" or other windows to appear and do not change the current window without informing the user.

WebAIM is an initiative of:
Center for Persons with Disabilities (CPD) Utah State University

Copyright 1999-2009 WebAIM

Top of Page