WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: changing focus location for screen readers

for

From: Jason Kiss
Date: Feb 8, 2011 2:57AM


On 08/02/11 20:53, adam solomon wrote:
> 1. When setting the search form to display: none at the page load. Then,
> when pressing on the link, the click event (or href with JS, doesn't matter)
> of the link sets the search form to display: block, and also sends the focus
> via JS to the<h2> (or even text input) of the search form (in the case of
> the<h2> we added tabindex="0" per aria standard which is fully supported in
> ie8). The result was that focus was sent to the<h2> of the search form, but
> the jaws cursor remained where it had been - namely on the link. Conclusion,
> no good.

Not sure if this will help, but a similar problem raised its head with
Ginader's Accessible Tabs plugin (see comments starting at
http://blog.ginader.de/archives/2009/02/07/jQuery-Accessible-Tabs-How-to-make-tabs-REALLY-accessible.php#serendipity_comment_580).
It turns out that programmatically setting focus to an element set to
display:block after previously having been hidden using display:none
didn't actually fully move the JAWS cursor to the intended focus
position. Some of this I've documented at
http://www.accessibleculture.org/research/accessible-tabs/. In brief, it
appears that focus was getting set before JAWS had updated its virtual
buffer, so while browser focus moved as expected, JAWS wasn't able to
fully move focus to the intended target.

With Ginader's Accessible Tabs plugin, this was solved by postponing the
point at which focus was programmatically set, based on the types of
events that trigger a virtual buffer update (see
https://reference.ssbbartgroup.com/index.php/Client_Side_Content_Changes_in_JAWS#When_Client-Side_Content_Changes)
such that the JAWS virtual buffer was already updated with the newly
visible element. This may or may not work for you.

I've also found in playing around that adding a short delay using
setTimeout(), e.g., on the order of 200ms, before setting focus can
sometimes work to allow the JAWS virtual buffer enough time to update. I
don't particularly like this approach, but it has worked for me in the
past, and being a very short timeout, is mostly imperceptible to the
user. I'm not quite sure what is going on, but wonder if it has to do
with the increased efficiency of JavaScript engines in newer browsers
somehow working too fast for JAWS and its virtual buffer. But I'd love
to be educated if anyone has some insight.

Anyway, just a couple of ideas.

Cheers,

Jason

--
Jason Kiss
Web: www.accessibleculture.org
Mobile: 021 929 238
Email: <EMAIL REMOVED>
Twitter: @jkiss