Arlene Kline negotiates the
JavaScript/Accessibility minefield with Java 'Guru' Dafydd Hopkin.
Arlene says: |
|
As part of our accessibility work we find lots of clients
asking how JavaScript and accessibility can sit together
according to the WAI guidelines. |
Dafydd says: |
|
I'd imagine it wouldn't impede it as such. JavaScript allows
you to do all kinds of things - it's a bit of a silly question.
A bit like saying the same about java... It's all a case of what
you do with it. |
Arlene says: |
|
For example, if a button caused a JavaScript routine to be
run could the screen reader access that information generated by
the JavaScript if it was in HTML? |
Arlene says: |
|
I.e., how would that function work with non-JavaScript
enabled browsers? |
Arlene says: |
|
Not that screen readers always have to work with
non-JavaScript enabled browsers |
Dafydd says: |
|
As screen readers are an extra layer put on top of a browser
it would have to depend on the screen reader. I'd imagine some
would be compatible with JavaScript, some not. |
Arlene says: |
|
With the added headache that those using screen readers would
be unlikely to be able to operate a mouse, so the code has to be
input device independent |
Dafydd says: |
|
I'd also guess it would depend on how you add JavaScript to
the page - if you do it so the browser DEPENDS on that
JavaScript you may well have problems if the screen reader
doesn't interpret it. |
Dafydd says: |
|
Often you can add 'non-JavaScript' approximations, that don't
do every flashy thing the JavaScript does, but still present a
usable interface. |
Arlene says: |
|
So would you also code for browsers that don't support
JavaScript by using <noscript>? |
Dafydd says: |
|
I'd think you'd have to. You simply can't assume a screen
reader will handle all of JavaScript – in fact a lot of it
simply wouldn't make any sense to a Text to Audio screen reader
for example. |
Arlene says: |
|
Are all versions of IE/Netscape JavaScript compatible? |
Dafydd says: |
|
Very early ones weren't - but we're talking about
1.0ish |
Dafydd says: |
|
JavaScript in IE and N/S can work
differently anyhow - sometimes you need to write code for
each of them. |
Arlene says: |
|
"- In fact a lot of it simply wouldn't make any sense to
a Text to Audio screen reader for example." This is a
problem as many sight-impaired users would use technology to
transform the site to text only then use a basic screen reader
to read the textual version |
Dafydd says: |
|
JavaScript is powerful - it can do things like change the
text of a paragraph as you move your pointer around the page.
That kind of thing would be v. Tricky to translate into pure
text... |
Arlene says: |
|
Doesn't help if you don't have a pointer though |
Dafydd says: |
|
Well exactly - so in that example putting it through a screen
reader loses something. |
Dafydd says: |
|
It's all a case of how you implement the JavaScript. If the
page is relying on it working then you're out of luck. If it
offers a decent alternative in (as you said) the <noscript>
tags - then you should be fine. |
Arlene says: |
|
So, to summarize... |
Dafydd says: |
|
Well, I'd say that generally JavaScript won't make it 'through'
to a screen reader - and if you ARE going to use it, you must be
certain to give a viable alternative for the screen readers. |
As regards browser compliancy and the WAI, the later browsers
from IE 5 and Netscape 4 *should* be WAI compliant.
It would also have to depend on the screen reader. I'd imagine
some would be compatible with JavaScript, some not. I'd also guess
it would depend on how you add JavaScript to the page - if you do
it so the browser DEPENDS on that JavaScript you may well have
problems if the screen reader doesn't interpret it. You simply
can't assume a screen reader will handle all of JavaScript – in
fact a lot of it simply wouldn't make any sense to a Text to Audio
screen reader for example. Additionally JavaScript in IE and N/S
can work differently anyhow - sometimes you need to write code for
each of them.
The key is not to implement key functionality in JavaScript and
to test anything you are unsure about. Not a pat or
quick-fix-solution I'm afraid.