Fix landmark-one-main in Shopify Liquid
Legacy Shopify themes and heavily customized storefronts often wrap {{ content_for_layout }} in <div class='main-content'> (leaving zero <main> landmarks) or accidentally render a second <main> inside a custom section. Wrapping {{ content_for_layout }} in exactly one <main id='MainContent' tabindex='-1'> inside layout/theme.liquid fixes every page on the store.
Before and after
{%- comment -%} layout/theme.liquid (Broken: generic <div> wrapper, no <main> landmark) {%- endcomment -%}
<body>
{% sections 'header-group' %}
<div id="MainContent" class="content-for-layout">
{{ content_for_layout }}
</div>
{% sections 'footer-group' %}
</body>{%- comment -%} layout/theme.liquid (Fixed: single <main> landmark + Skip-to-Content link) {%- endcomment -%}
<body>
<a class="skip-to-content-link visually-hidden" href="#MainContent">
{{ 'accessibility.skip_to_text' | t | default: 'Skip to content' }}
</a>
{% sections 'header-group' %}
<main id="MainContent" class="content-for-layout focus-none" tabindex="-1">
{{ content_for_layout }}
</main>
{% sections 'footer-group' %}
</body>Fixed vs. broken example
Pair your single <main id="main-content" tabindex="-1"> landmark with a visible-on-focus "Skip to main content" link at the top of <body>.
Playwright + axe-core check
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";
test("Shopify theme.liquid renders exactly one <main> landmark", async ({ page }) => {
await page.goto("/");
await expect(page.getByRole("main")).toHaveCount(1);
const results = await new AxeBuilder({ page })
.withRules(["landmark-one-main"])
.analyze();
expect(results.violations).toEqual([]);
});Template deduplication tip
Missing or duplicate <main> tags inside layout/theme.liquid trigger on 100% of storefront URLs—home, products, collections, cart, and blogs. A11yDrift highlights it as a single root layout edit.
What NVDA and VoiceOver announce
Keyboard and screen-reader users rely on the <main> landmark (and Skip-to-Content links targeting it) to bypass 30+ repeating header, mega-menu, and announcement links on every page navigation.
NVDA (Windows)
Pressing D (next landmark) announces: "no next landmark"
Pressing D jumps straight past navigation and announces: "main landmark"
VoiceOver (macOS / iOS)
Landmarks rotor shows no Main region; user must step through every header link.
Landmarks rotor lists "main", letting the user jump directly to primary content.
Common questions
Why put tabindex='-1' on <main id='MainContent'> in Shopify?
What if a Shopify landing-page app (PageFly/Shogun) injects a second <main>?
Does Shopify's Skip-to-Content link need to become visible on keyboard focus?
Test a URL for landmark-one-main
Enter any public URL for a free WCAG 2.2 AA check—no account or credit card required.
Managing Shopify Liquid client sites? Monitor 15 sites on one flat plan with white-label portals and branded executive PDFs—$1,140/yr ($95/mo billed annually, 24-month rate lock + onboarding) for Founding 10 agencies.