Simply Accessible

Search Results Page Layout

Summary

Posting from a form to a specific fragment identifier on the page helps to indicate that something on the page has changed, and allows you to provide a conveniently worded skip link to bypass a repeated form.

More about the author

When we use systems that include searching capability such as back end administration tools, we often see search forms presented both on the page that you search from and the page that displays the search results. This can be very useful for both the user and the programmer:

However, this does cause some problems for visually impaired users, and (I’ll freely admit) sometimes throws me off for a number of reasons:

View a typical search and results page that demonstrate these problems.

Fortunately there are a number of things that can be done to improve this functionality.

First, we can change the action of the form to include a fragment identifier/named anchor for the results page.

<form method="post"
       action="whatever-page.php#results >
   ... form elements here ... 
</form>

Next, we create that element within the results page, and use that element to do two things: 1) provide a statement about how many results were found, and 2) link that statement to another node within the page.

Found <a id="results" href="#details">25 results for keyword</a>

This accomplishes two things:

  1. including the statement itself lets any user know right away that something has changed on the page
  2. posting directly to that node places the focus where it is most relevant
  3. linking the statement is very clear, and acts as a very precise link that “skips over the form” without actually being called a skip link.

In my final example, I’ve also included a link after the search results that submits back to the form itself to make it easier to “Search again.”

View the improved search and results page

Other considerations

You might also consider it useful to change the page’s <title>...</title> to indicate that you are viewing the results page as well as the number of results found, or which ones you are displaying.

It may be useful when this is implemented within a template to actually submit to a named anchor or ID that is just above the desired target so that the target isn’t right at the very top of the viewport.

Providing some other visual cue to draw attention that particular node/link would likely provide benefit as well.

This technique could be applied to any form on a page that submits to itself.

Permalink to this article