WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Focus should always be set somewhere, right?


From: Patrick H. Lauke
Date: Jan 30, 2016 3:51PM

On 30/01/2016 22:08, Robert Fentress wrote:
> I just wanted to confirm that focus should always be set somewhere. For
> instance, in rich internet applications you may interact with a control and
> that may cause the control to disappear. In those instances, focus should
> always be explicitly set somewhere after that item is removed from the DOM,
> correct?

Yes. One interesting thing I noticed (but haven't got around to writing
up anywhere) is that VO (at least on iOS) seems to have built-in
heuristics to hunt for focus when it's lost - for instance, say you're
currently on the close button of an HTML dialog, and that once closed
the focus isn't correctly set back somewhere sensible. VO will usually
try to find the focusable element that's nearest to the last known
position in the viewport where it had focus, so it will generally set
focus (unless done explicitly) to whatever was approximately under the
close button in the main page.

> On a related note, are there rules for where the virtual cursor (or
> equivalent) in screen readers goes when such items are removed from the
> DOM? It seems pretty random in my experience, but perhaps there is a
> pattern I'm missing.

Usually on desktop, the focus is lost completely - as if you entered the
page again for the first time. On subsequent TAB you'd be focused on the
first focusable element of the page. Maybe the randomness you experience
is due to the heuristic above?

Patrick H. Lauke

www.splintered.co.uk | https://github.com/patrickhlauke
http://flickr.com/photos/redux/ | http://redux.deviantart.com
twitter: @patrick_h_lauke | skype: patrick_h_lauke