Shopify Liquid fix

Before and after

Broken — before
{%- comment -%} snippets/facets.liquid (Broken: sort <select> has no label or aria-label) {%- endcomment -%}
<select name="sort_by" class="facet-filters__sort">
  {%- for option in collection.sort_options -%}
    <option value="{{ option.value | escape }}"{% if option.value == sort_by %} selected{% endif %}>
      {{ option.name | escape }}
    </option>
  {%- endfor -%}
</select>
Fixed — after
{%- comment -%} snippets/facets.liquid (Fixed: explicit <label for> bound with section.id) {%- endcomment -%}
<div class="facet-filters__field">
  <label class="facet-filters__label" for="SortBy-{{ section.id }}">
    {{ 'products.facets.sort_by_label' | t | default: 'Sort by' }}
  </label>
  <select
    id="SortBy-{{ section.id }}"
    name="sort_by"
    class="facet-filters__sort"
    aria-describedby="a11y-refresh-page-message"
  >
    {%- for option in collection.sort_options -%}
      <option value="{{ option.value | escape }}"{% if option.value == sort_by %} selected{% endif %}>
        {{ option.name | escape }}
      </option>
    {%- endfor -%}
  </select>
</div>
Live preview

Fixed vs. broken example

Passes select-name
Accessibility tree: role="combobox", accessible name="Sort products by", value="Featured"

Avoid relying on a dummy first <option> like "Sort by..." as the sole label; once a user picks an option, the purpose disappears for everyone.

Automated test

Playwright + axe-core check

tests/a11y-select-name.spec.ts
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";

test("Shopify collection sort & product variant selects pass select-name", async ({ page }) => {
  await page.goto("/collections/all");
  await expect(page.getByRole("combobox", { name: /sort by/i })).toBeVisible();
  const results = await new AxeBuilder({ page })
    .withRules(["select-name"])
    .analyze();
  expect(results.violations).toEqual([]);
});

Template deduplication tip

An unlabeled sort_by <select> in snippets/facets.liquid fails across every /collections/* URL, and an unlabeled currency selector in sections/footer.liquid fails on every store page. Fix that one Liquid snippet to resolve the entire cluster.

Screen readers

What NVDA and VoiceOver announce

E-commerce variant pickers (Size, Color), collection sort dropdowns, and country selectors without a programmatic <label> or aria-label announce only the first option ('Featured' or 'Small'), hiding what the dropdown controls.

NVDA (Windows)

Broken

"combo box, Featured, collapsed" (purpose of selector unknown)


Fixed

"Sort products by, combo box, Featured, collapsed"

VoiceOver (macOS / iOS)

Broken

"Featured, pop-up button"


Fixed

"Sort products by, Featured, pop-up button"

Common questions

Why does Shopify's country/currency selector in footer.liquid often fail select-name?
Many themes style the localization dropdown as a compact flag/currency pill without a visible label. Add <label for='FooterCountry-{{ section.id }}' class='visually-hidden'>Country/region</label> to bind an accessible name cleanly.
How should multi-option Shopify product variants (Size + Color) be labeled?
Use the Liquid loop index (id='Option-{{ section.id }}-{{ forloop.index0 }}') paired with <label for='...'>{{ option.name | escape }}</label> so Size and Color pickers each receive distinct labels.
Does a default <option> like 'Select size' satisfy select-name?
No—the first <option> represents the control's value, not its programmatic accessible name, and disappears as soon as the shopper chooses 'Medium'. Always bind an explicit <label>.