Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript and Accessibility

Tags:

As a web developer, a number of the projects I work on fall under government umbrellas and hence are subject to 508 Accessibility laws, and sometimes W3C accessibility guidelines. To what extent can JavaScript be used while still meeting these requirements?

Along these lines, to what extent is JavaScript, specifically AJAX and using packages like jQuery to do things such as display modal dialogues, popups, etc. supported by modern accessibility software such as JAWS, Orca, etc? In the past, the rule went something like "If it won't work in Lynx, it won't work for a screen reader." Is this still true, or has there been more progress in these areas?

EDIT: The consensus seems to be that javascript is fine as long as there are non-javascript fallbacks, however it still seems uncertain about the support for AJAX in screen reader software. If anyone has specific experience with this, that would be most helpful.

like image 285
cdeszaq Avatar asked Nov 05 '08 21:11

cdeszaq


People also ask

Is JavaScript accessible?

A web page containing JavaScript will typically be fully accessible if the functionality of the script is device independent (does not require only a mouse or only a keyboard) and the information (content) is available to assistive technologies.

Do screen readers work with JavaScript?

They don't parse the HTML directly but an accessible tree view of a document. This means that if your browser understands javascript, your screenreader will. That because, your screen reader will not access the DOM directly on the load of the page, but will interact with the Accessibility API provided by your browser.

Is JavaScript 508 compliance?

Section 508 compliance rules do not specify at all whether you use or do not use Javascript. It merely enforces the fact that you must provide equal access to the information you are presenting electronically, regardless of electronic delivery method.


2 Answers

I think the answer is really in how you architect things. JQuery has the capability to be unobtrusive and therefore accessible. The trick is to have redundancy around your AJAX calls so browsers without JavaScript can still utilize your service. In other words, wherever you have JavaScript responses, dialogs, etc you need to have a degraded equivalent.

If you have accessibility in mind and you're properly testing for both use cases (JavaScript vs. Non-JavaScript) you should be able to write applications that cater to both audiences.

Example ($(document).ready call omitted for clarity and brevity:

<script>
  $("#hello").click(function(){
    alert("Hi");
  });
</script>
<a href="/say_hello.htm" id="hello">Say Hello</a>

A trivial example but basically this will only evaluate the click JavaScript event if JavaScript is supported. Otherwise, it will perform like a normal link and go to say_hello.htm - your job as the developer is to make sure that both outcomes are handled for appropriately.

Hope that helps!

like image 39
danpickett Avatar answered Oct 18 '22 05:10

danpickett


If accessibility is your primary concern, always start a website using standards-compliant (pick a Document Type Definition and stick to it) HTML. If it's a web application (form submissions, etc), make sure the forms will work using just HTTP GET and POST. Once you have a complete website/application you can add bits of CSS and JavaScript as long as the site still functions, with either or both off.

The most important concept here is Progressive Enhancement. You're adding additional bells and whistles using CSS/JavaScript, but your web site/application will function perfectly well without either.

A great tool for testing 508, WAI, CSS off, JavaScript off try using the Web Developer plugin for Firefox.

like image 90
Jake McGraw Avatar answered Oct 18 '22 06:10

Jake McGraw