WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Initial focus on search field?

for

From: Don Mauck
Date: Sep 22, 2014 1:57PM


If they are JAVA scripts with automatic evaluations such as: a drop down with options such as one week< last 30 day, ETC. However my next question is if ARIA is used how does a keyboard user only do this easily, using ARIA? including the ARIA code. .

-----Original Message-----
From: Robert Fentress [mailto: <EMAIL REMOVED> ]
Sent: Monday, September 22, 2014 1:35 PM
To: WebAIM Discussion List
Subject: [WebAIM] Initial focus on search field?

Hello, all.

Do you have a sense for what is best practice concerning where focus should initially be set on pages in complex web sites that contain a prominent global search field on every page?

For our site, the search field appears after an initial set of navigation links, and at this point, changing the order of the menu links and the search field in the code isn't feasible. An original design constraint was that the search field be automatically given focus upon page load, since usability studies showed that most people preferred using search to navigate the site.

However, I was concerned that this could present problems for screen reader users who might not notice the list of links before the search field. This does seem to be a common pattern on the web though, so I wonder if screen reader users would expect (and perhaps prefer) this behavior.

Initially though, I recommended against explicitly setting focus.
Instead, I suggested best practice would be to add, at the start of the page, a single skip link to the main content, and to create landmark regions for the main page areas (including role="search" for the where the search field appears). Screen reader users could then use landmark navigation to quickly get to the search field.

The developer has gotten pushback though, because of the original design requirement mandating that focus be set to the initial search field. He has tried to be creative by not initially setting focus, instead making it so that, as soon as the user begins typing, focus is set to the search field. So a tab takes the user to the first link in the menu on the page, but typing "a search string" automatically moves the user to the search field and enters the text typed into the field.
This is problematic, though, because some keys are reserved as page navigation commands by some screen readers, such that typing "b" takes you to the first button on the page, etc.

At this point, given the constraints we're operating under, I'm leaning towards just telling him to set focus to the search field, with the thought that screen reader users may expect this sort of thing and figure things out, especially given the landmarks provided.
What do you think?

Thanks,
Rob

--
Robert Fentress
Senior Accessibility Solutions Designer
540.231.1255

Technology-enhanced Learning & Online Strategies Assistive Technologies
1180 Torgersen Hall
620 Drillfield Drive (0434)
Blacksburg, Virginia 24061