WebAIM - Web Accessibility In Mind

E-mail List Archives

Thread: Auto-focusing form fields

for

Number of posts in this thread: 4 (In chronological order)

From: Tim Beadle
Date: Wed, Apr 18 2007 7:30AM
Subject: Auto-focusing form fields
No previous message | Next message →

Hello all,

We've just had an accessibility audit done on one of our sites:
http://medicalphysicsweb.org/

One of the recommendations made was that we remove the JavaScript that
auto focuses the first (or first with an error) field in a form, as it
causes screen readers to skip past the error text, which is
unfortunately displayed before the start of the form itself.

One of my colleagues is sceptical and wants more proof (i.e. whether
it is indeed a problem, and which screen readers this applies to).

Can anyone shed any more light?

Thanks,

Tim

From: Alastair Campbell
Date: Wed, Apr 18 2007 9:00AM
Subject: Re: Auto-focusing form fields
← Previous message | Next message →

Tim wrote:
> One of the recommendations made was that we remove the JavaScript that
> auto focuses the first (or first with an error) field in a form, as it
> causes screen readers to skip past the error text, which is
> unfortunately displayed before the start of the form itself.

Hi Tim,

You might get conflicting advice, most agreeing, but nobody seems to
have a problem with Google doing it! (Then again, I suspect quite a few
screen reader users probably don't realise there are options above the
search.)

I would class moving the focus around without informing the user as
similar to new windows (without informing the user) or a tabindex that
doesn't follow the document flow, i.e. confusing.

In the situation you describe, it is quite likely to be an issue,
because (I assume) the page reloads and plonks the focus in the middle
somewhere. The user is probably expecting to be on a new page, so it's
important to change that expectation quickly.

I would consider putting the focus at the top of the content area (above
the error message), but I wouldn't move it into the form.

I'm afraid I don't have much to back this up with, we came across it a
few years ago causing issues and have avoided it ever since.

As a general rule, I'd put error text at the top ("there are X problems
on the form below"), and a specific message above the field(s) with
errors as well.

Kind regards,

-Alastair

--
Nomensa | Director of User Experience

Internet World - come and meet us on stand W327:
http://www.nomensa.com/news/events/internet-world-2007.html

From: Tim Beadle
Date: Wed, Apr 18 2007 9:20AM
Subject: Re: Auto-focusing form fields
← Previous message | Next message →

On 18/04/07, Alastair Campbell < = EMAIL ADDRESS REMOVED = > wrote:
> You might get conflicting advice, most agreeing, but nobody seems to
> have a problem with Google doing it! (Then again, I suspect quite a few
> screen reader users probably don't realise there are options above the
> search.)

Indeed - a lot of people have said "it depends on the context" but
this would only apply from a usability, not accessibility, standpoint.

As I understand it, if a screenreader skips past the explanatory text
for a field, then the user has no clue what the purpose of the field
is.

> I would class moving the focus around without informing the user as
> similar to new windows (without informing the user) or a tabindex that
> doesn't follow the document flow, i.e. confusing.
>
> In the situation you describe, it is quite likely to be an issue,
> because (I assume) the page reloads and plonks the focus in the middle
> somewhere. The user is probably expecting to be on a new page, so it's
> important to change that expectation quickly.
>
> I would consider putting the focus at the top of the content area (above
> the error message), but I wouldn't move it into the form.
>
> I'm afraid I don't have much to back this up with, we came across it a
> few years ago causing issues and have avoided it ever since.
>
> As a general rule, I'd put error text at the top ("there are X problems
> on the form below"), and a specific message above the field(s) with
> errors as well.

We may implement focusing the content area instead, but for the moment
we've just removed the field auto-focusing.

Thanks for your input.

Tim

From: Spruill Kevin
Date: Wed, Apr 18 2007 12:30PM
Subject: Re: Auto-focusing form fields
← Previous message | No next message

"One of my colleagues is sceptical and wants more proof (i.e. whether it
is indeed a problem, and which screen readers this applies to)."

Ummmmmm... Yes - it is potential problem - as noted in your explanation,
if the error message is passed over by the auto focus, it really isn't
being presented to the screenreader users.

I would presume this is an issue with all screen readers.

Kevin Spruill
IT Specialist
Information Resources Accessibility Program
OS:CIO:ES:BI:CS:IRAP:IT
Phone: (202) 283-7059
IRAP Web site: http://irap.web.irs.gov

-----Original Message-----
From: Tim Beadle [mailto: = EMAIL ADDRESS REMOVED = ]
Sent: Wednesday, April 18, 2007 9:28 AM
To: WebAIM Discussion List
Subject: [WebAIM] Auto-focusing form fields

Hello all,

We've just had an accessibility audit done on one of our sites:
http://medicalphysicsweb.org/

One of the recommendations made was that we remove the JavaScript that
auto focuses the first (or first with an error) field in a form, as it
causes screen readers to skip past the error text, which is
unfortunately displayed before the start of the form itself.

One of my colleagues is sceptical and wants more proof (i.e. whether it
is indeed a problem, and which screen readers this applies to).

Can anyone shed any more light?

Thanks,

Tim