• Share this article:

Accessibility and ACTF

Wednesday, September 3, 2008 - 23:47 by Wayne Beaton

I learned a little something about accessibility today while playing with the Accessibility Tools Framework (ACTF) project’s Java Validation Componentry (Javaco).

Actually, I learned a couple of things before I learned the interesting part. First, Javaco currently works on Windows. Try as I might, Linux just isn’t supported. Lesson learned: read the documentation before spending an hour hunting down a bug that isn’t there.

Javaco goes through your user interface and determines whether or not it is valid to call it “accessible”. It looks for all kinds of things, like whether or not tooltips have been provided for fields and buttons; it also does this clever label/text association that I haven’t quite gotten my head around (a text field has to have a corresponding label).

Using Javaco is pretty easy. I selected a class that extends SWT‘s Composite class, and selected “Accessibility Tools > Perform Validation” from the context menu. The result looks something like this:

actf.png

My first error threw me for a loop: it told me that my composite was “Missing Accessible Name”. “No problem”, I thought, “I’ll just have to set that.” After a few minutes of fruitless searching, I determined that there was no method that reads anything like setAccessibleName anywhere in the SWT Text widget’s hierarchy. I was stumped. After regrouping, I came across the getAccessible() method. With a little help from the javadoc, and the SWT snippets page, I was back in business.

The Accessible Name for a widget is text that can be spoken by an accessible computer to help a user navigate through a form. You don’t actually set any value; you have to tell the widget how to respond to a request for it. Code along these lines does the job:

this.getAccessible().addAccessibleListener(new AccessibleAdapter() {
	public void getName(AccessibleEvent e) {
		e.result = "Enter personal information on this form.";
	}
});

You can (and in some cases are required to) set other values, including keyboard navigation equivalents on push buttons using the listener.

Javaco found a bunch of other problems, such as some missing tooltips (which I believe the accessibility software uses for the accessible name when available). I’m still pretty new at this, so I’m sure that there’s much more that it can (and will) expose as I play with it some more.

Javaco adds several new views to the workbench, including the “Rendered GUI” view (shown bottom left above) that manifests the composite you’re testing. The view is live and you can interact with it. It’s pretty cool: whenever you save the code, the Rendered GUI view gets updated. This is pretty handy all by itself (you can test your composite as you’re building it without have to explicitly test). The “Validation Report” view (shown bottom right above) summarizes the results of validation. The “Rulebase Viewer” view provides an overview of the rules that the validator uses and seems to have the ability to extend the set of rules.

If you’re building applications that need to be accessible, then you need to spend a little time with ACTF.