Home / Components

How to make a Shopify search bar accessible

Published October 8, 2026

The search bar looks simple and fails often. It is the control most dependent on keyboard interaction, the one most likely to have a dynamic suggestions dropdown, and the one where a small markup mistake locks out every keyboard and screen reader user. Getting it right is a short checklist, and most stores miss at least one item.

Start with a real label

The most common search bar failure is the missing label. The input has a placeholder that says Search, and the developer considers the job done. Placeholders are not labels: they disappear when the user types, they are often skipped by screen readers in forms mode, and they fail contrast requirements at small sizes. Add a proper label element associated with the input, or an aria-label on the input itself. Visually, you can hide the label if the design demands it, but it must exist in the markup.

The search button needs the same treatment. A magnifying-glass icon button with no accessible name is announced as button, which tells the user nothing. Give it an accessible name like Search. If the button submits the form, make sure it is a real submit button inside a real form, so Enter in the input submits. Divs with click handlers are the enemy here: they break keyboard submission, they break screen reader expectations, and they are never worth the styling convenience.

The suggestions dropdown is where it breaks

A search input with predictive suggestions is a combobox pattern, and it has specific requirements. The input needs role combobox with aria-expanded reflecting whether the suggestion list is open, and aria-controls pointing at the listbox. As the user arrows through suggestions, aria-activedescendant on the input should track the highlighted option. Each suggestion is an option in the listbox. This sounds like a lot of attributes, and it is, because the alternative is a screen reader user hearing a silent dropdown appear and having no way to perceive or operate it.

Test the dropdown with only a keyboard. Typing should open it, arrow keys should move through suggestions, Enter should select, and Escape should close the dropdown without clearing what the user typed. That last behavior is the one most implementations get wrong: Escape either does nothing, which traps the user, or it wipes the input, which destroys their work. Escape closes the popup. That is its job. A second Escape press can clear the input if you want, but the first press must only dismiss the list.

Announce results, do not just render them

When suggestions load, sighted users see them appear. Screen reader users need the equivalent signal. A polite live region announcing the number of suggestions, such as 6 suggestions available, gives orientation without interrupting typing. When the user submits the search and the results page loads, the results heading should include the count: 24 results for wool sweater. An empty results page needs a real message, not a blank grid: no results found, with a suggestion to try different terms. Silence after a search is indistinguishable from a broken page.

Loading states need announcements too. If suggestions take a moment to fetch, the live region should say searching rather than leaving the user wondering whether the dropdown is broken. Keep the announcements concise. Nobody wants a play-by-play of every keystroke, just the state changes that matter: opened, results count, closed.

The mobile search overlay

On mobile, search usually lives behind an icon that opens a full overlay. The overlay needs the same discipline as a dialog: move focus into the search input when it opens, trap focus inside while it is open, and return focus to the triggering icon when it closes. The background page should be inert while the overlay is up. Most mobile search overlays fail the focus return, which strands keyboard users at the top of the page after every search.

Check the overlay against the header on scroll as well. Some themes keep the search input visible in a sticky header while the overlay version also exists, creating two search inputs with the same label. Duplicate labels confuse screen reader users who cannot tell which one is active. If both exist, differentiate the accessible names or remove one from the tab order when it is not visible.

The search bar is worth this attention because it is a task-critical control. Users who search have intent; they are closer to buying than browsers. An inaccessible search bar does not just fail an audit, it turns away the store's most motivated visitors at the exact moment of intent. Label it, wire the combobox pattern, announce the states, and test the whole thing without a mouse. It is an afternoon's work that pays for itself in the first week.