For those who haven’t heard of AJAX before, I recommend you head over to Jesse James Garrett’s article “Ajax: A New Approach to Web Applications” for a good introduction. If you want more information on how to create your own AJAX forms, see the references section at the end of this article. If you can’t be bothered to read that, here is the outline: There are two ways of dealing with forms when working with web applications:
- Update the entire screen when the user clicks the submit button. Data is posted to the server, analyzed and depending on the business logic the user is redirected to a new page or the same page is rendered again. Let’s call this traditional forms.
What are the advantages?
There are many advantages in using the AJAX forms. It is possible to create a more advanced user interface that doesn’t refresh the page for every change made by the user. For complex forms usability can be improved as it is possible to make updates as the user moves through the form. An example could be to validate complex form field data or make server side calculations as the user leaves a field.
Many inexperienced web users have difficulties understanding the traditional way of posting form data. Especially in situations where pressing the back button after submitting a form makes the browser display a warning message about form data being resubmitted.
What’s the problem with AJAX?
Using AJAX forms require more from the client compared to traditional forms:
- The browser has to support the XMLHttpRequest object (or similar). Currently this is available in Mozilla, Firefox, Internet Explorer and Safari. Rumour has it that Opera will introduce it soon.
These requirements should not pose a problem for most applications. A lot of web applications are developed for a particular organisation where the client environment typically is very standardised.
But, there are some other problems regarding accessibility. Consider this simple AJAX calculator. Screen reader users have no problem using the form. But when they click the “Add” button they will not know that the result value has been updated. This, obviously, is a major problem.
Even sighted users may have difficulties understanding what area of the page was updated. Miniscule changes are hard to detect on screen, especially if you are looking at the keyboard while typing (I still do).
Does this mean you shouldn’t use AJAX for your web UI?
Improving accessibility of AJAX forms
Fortunately there are some things we can do to increase accessbility of AJAX forms. Here are my recommendations:
- Inform the user that the page is updated dynamically. This is especially important for screen reader users and will help them decide when to trigger a re-read of the page.
- Make it possible to recieve an alert when information was updated. This may not be practically possible depending on the complexity of your form but will help a screen reader user a lot. Alert boxes are read by the screen reader and are usually displayed together with a sound. The checkbox should be displayed so it is clear that it is not part of the original form.
- Highlight recently updated areas for a short period of time. This will help sighted users understand what just happened. The nice folks over at 37signals have dubbed this “The Yellow Fade Technique” but you can use any colour you like. Check out Adam Michela’s code for another way of providing the fade.
I hope this article will inspire you to make sure your AJAX forms are accessible.