Shopify Liquid fix

Before and after

Broken — before
{%- comment -%} sections/footer.liquid (Broken: placeholder-only newsletter input) {%- endcomment -%}
{%- form 'customer', class: 'footer__newsletter' -%}
  <input
    type="email"
    name="contact[email]"
    placeholder="Enter your email"
    required
  >
  <button type="submit">Subscribe</button>
{%- endform -%}
Fixed — after
{%- comment -%} sections/footer.liquid (Fixed: section-scoped <label for> binding) {%- endcomment -%}
{%- form 'customer', class: 'footer__newsletter' -%}
  <div class="field">
    <label for="NewsletterEmail-{{ section.id }}" class="field__label">
      {{ 'newsletter.label' | t | default: 'Email address' }}
    </label>
    <input
      id="NewsletterEmail-{{ section.id }}"
      type="email"
      name="contact[email]"
      autocomplete="email"
      placeholder="alex@example.com"
      required
    >
  </div>
  <button type="submit">{{ 'newsletter.button_label' | t | default: 'Subscribe' }}</button>
{%- endform -%}
Live preview

Fixed vs. broken example

Passes label
Accessibility tree: role="textbox", accessible name="Work email address" (programmatically bound via <label for="demo-work-email">)

Click directly on the "Work email address" label in the fixed preview: native browsers expand the hit target and immediately move focus into the input.

Automated test

Playwright + axe-core check

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

test("Shopify footer newsletter and search inputs pass axe-core label", async ({ page }) => {
  await page.goto("/");
  await expect(page.getByLabel(/email/i)).toBeVisible();
  const results = await new AxeBuilder({ page })
    .withRules(["label"])
    .analyze();
  expect(results.violations).toEqual([]);
});

Template deduplication tip

An unlabeled email input inside sections/footer.liquid fires on every single page of your Shopify store. A11yDrift merges all of those footer alerts into one global layout cluster—fix sections/footer.liquid once to clear 100% of routes.

Screen readers

What NVDA and VoiceOver announce

Placeholder-only inputs lose their hint the moment a user starts typing, cannot be focused by clicking a visible label target, and leave screen-reader and cognitive-disability users guessing which data belongs in each field during checkout or signup.

NVDA (Windows)

Broken

"edit, has auto complete, blank" (no field purpose announced)


Fixed

"Work email address, edit, has auto complete, blank"

VoiceOver (macOS / iOS)

Broken

"edit text, Work email address" (inconsistent placeholder fallback that disappears once filled)


Fixed

"Work email address, edit text"

Common questions

Why use {{ section.id }} in Shopify Liquid input IDs?
Merchants can place multiple newsletter or search sections on one storefront page. Appending {{ section.id }} guarantees every <label for> points to a unique DOM id without duplicate-id collisions.
Why isn't placeholder='Email' enough to pass WCAG 1.3.1 & 3.3.2?
Placeholders vanish as soon as a shopper starts typing, typically have sub-4.5:1 gray contrast, and are inconsistently exposed as accessible names across browser/screen-reader combinations.
Can I visually hide a Shopify search input's label if a magnifying glass icon is beside it?
For single-field search bars, a .visually-hidden <label for='...'> paired with a clearly labeled Submit button passes axe-core label, though visible labels are always preferred for multi-field checkout and contact forms.