Metadata
Title
✎ Technique: Site search
Category
general
UUID
1b88d48bad5945099f039f12ebb77344
Source URL
https://accessibility.huit.harvard.edu/technique-site-search
Parent URL
https://accessibility.huit.harvard.edu/support-navigation-and-wayfinding
Crawl Time
2026-03-23T03:13:31+00:00
Rendered Raw Markdown

✎ Technique: Site search

Source: https://accessibility.huit.harvard.edu/technique-site-search Parent: https://accessibility.huit.harvard.edu/support-navigation-and-wayfinding

People use different methods to find web content. Screen-reader users might prefer navigation regions, people with dyslexia might prefer the logic of a site map, and people with motor impairments might prefer to type in a search term using a search facility.

So it's important the search facility on your site is logically and conventionally placed and constructed for optimal accessibility.

Example

To maximize comprehension for people scanning the page visually, you should provide a text field with a helpful placeholder and a suitably labelled button (such as "search") rather than a symbol or icon. The search feature should appear above the main content of the page, typically inside or below the page header and navigation.

In terms of markup, there are some specifics you should take into account, as shown in this snippet:

<search role="search">\ <form>\ <label for="search" class="vh">Search the site</label>\ <input type="text" id="search" placeholder="Eg. chocolates" />\ <button type="submit">search</button>\ </form>\ </search>

Notes

.visually-hidden {\ position: absolute !important;\ clip: rect(1px, 1px, 1px, 1px);\ padding:0 !important;\ border:0 !important;\ height: 1px !important;\ width: 1px !important\ ;  overflow: hidden;\ }

Placeholder attributes are not reliably read in assistive technologies, and since the "search" label of the button will not have been focused first, this is the most reliable way to tell the user what the input is for. - The search form is placed within a <search> element. This means screen reader users should be told they are in a search region when they focus the input. It also means that the area will turn up in "landmarks" (regions) navigation dialogs, and it can be reached using keyboard shortcuts such as the "r" key in JAWS. The <search> element is relatively new, added to modern browsers in 2023; adding a role="search" attribute ensures it's recognized as a landmark in older browsers. - For browsers that support placeholder styling, the text color should be made a darker gray than is often the browser default, allowing for easier reading.

See also: