Design Principles
Ensure all site navigation and interoperability is device independent and can be performed using the keyboard
§ 508 1194.24 (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 can be read by assistive technology.
JavaScript is most commonly used scripting language to create HTML documents that are more dynamic, functional and interactive. When used programmatically, scripts can detect user agents, increase user interaction, control web content and other processes to enhance the functionality and accessibility of a web page.
While scripting can be used to enhance functionality of web pages, they can also make the pages inaccessible. When designing web pages using scripts ensure the JavaScript is directly accessible or provide an accessible, non-JavaScript alternative.
Accessible JavaScripts expose the content to screen readers and makes all activities device independent (performed using keyboard).
On the web, an event is a function that produces an activity like triggering a link, submitting a form, loading a page, alerting the user etc. Events can occur programmatically or as a result of user interaction.
Event handlers are scripts that trigger an activity when an event is initiated and perform both essential and non-essential functions. A function is considered
- essential when the script performs operations that effect the web content
- non-essential when operations are for creating special visual effects that do not impact the content or user transaction
Script Function |
JavaScript Accessibility |
|---|---|
Scripts essential to the functionality of a page |
|
Image roll overs - image changes when it receives focus with mouse or keyboard |
|
Emulating browser functions like back, close window, print page etc |
|
"Programmatic Animations" or timed events like timed presentations |
|
Page refresh, redirects and event timeouts |
|
Change focus to a different window without warning - Links to pup-up or new windows |
|
For events that do more than just change the presentation of an element |
|
Dynamic menus or fly-outs (mouse dependent) |
|
Menus using style sheets and form controls like drop-down combo boxes |
|
Forms |
|
Use Javascript to enhance a functionality that is already present. The <noscript> element can be used to to provide alternative content for when scripts are not supported or when users have the script functionality turned off.
Code with <noscript> element
<script type="text/javascript">
<!-- document.write("Hello World!") ;
document.write('<img src="myimage.gif" alt="text description" border="0">') //-->
</script>
Hello world!
<img src="myimage.gif" alt="text description" border="0">
</noscript>
