Shopify Liquid fix

Before and after

Broken — before
{%- comment -%} sections/product-tabs.liquid (Broken: tablist with unattributed <li> & <button>) {%- endcomment -%}
<div class="product-tabs" role="tablist" aria-label="{{ product.title | escape }} information">
  <ul class="tabs-nav">
    <li><button type="button" data-tab="desc">Description</button></li>
    <li><button type="button" data-tab="care">Care &amp; Sizing</button></li>
  </ul>
</div>
Fixed — after
{%- comment -%} sections/product-tabs.liquid (Fixed: role="none" on <li> and role="tab" on buttons) {%- endcomment -%}
<ul class="tabs-nav" role="tablist" aria-label="{{ product.title | escape }} information">
  <li role="none">
    <button
      type="button"
      role="tab"
      id="TabDesc-{{ section.id }}"
      aria-selected="true"
      aria-controls="PanelDesc-{{ section.id }}"
    >
      Description
    </button>
  </li>
  <li role="none">
    <button
      type="button"
      role="tab"
      id="TabCare-{{ section.id }}"
      aria-selected="false"
      aria-controls="PanelCare-{{ section.id }}"
      tabindex="-1"
    >
      Care &amp; Sizing
    </button>
  </li>
</ul>
Live preview

Fixed vs. broken example

Passes aria-required-children
Accessibility tree: role="tablist" directly owns role="tab" (selected, 1 of 2) and role="tab" (unselected, 2 of 2)

Remove extraneous intermediate wrapper <div>s between a composite ARIA parent and its required children—or set role="none" on purely structural wrappers.

Automated test

Playwright + axe-core check

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

test("Shopify product tabs & mega-menu pass aria-required-children", async ({ page }) => {
  await page.goto("/products/cobalt-ceramic-mug");
  const results = await new AxeBuilder({ page })
    .withRules(["aria-required-children"])
    .analyze();
  expect(results.violations).toEqual([]);
});

Template deduplication tip

A predictive-search role='listbox' or header mega-menu role='menubar' inside sections/header.liquid triggers on every Shopify route. Fixing that single Liquid section eliminates the violation across every product and collection URL.

Screen readers

What NVDA and VoiceOver announce

When a container declares role='tablist', role='menu', or role='listbox' without directly owning its required child roles (tab, menuitem, option), assistive technologies break arrow-key navigation, item counts ('1 of 3'), and selection state announcements.

NVDA (Windows)

Broken

"Product details, tab control" -> "Specs, button" (item count and selected tab semantics lost)


Fixed

"Product details, tab control, Specs, tab, selected, 1 of 2"

VoiceOver (macOS / iOS)

Broken

"Product details, tab group, 0 items" -> "Specs, button"


Fixed

"Specs, selected, tab, 1 of 2, Product details, tab group"

Common questions

Why put role='none' on <li> elements inside a <ul role='tablist'>?
A plain <li> exposes role='listitem', which is not a permitted child of role='tablist'. Setting role='none' (or role='presentation') removes the listitem semantics so the child <button role='tab'> is directly owned by the tablist.
Why do Shopify third-party review apps trigger aria-required-children?
Many review widgets inject <div role='list'> containers holding pagination controls or headings that lack role='listitem'. Audit app blocks with A11yDrift and configure or replace widgets that output malformed ARIA trees.
Should Shopify header dropdown menus use role='menu'?
Prefer native <details><summary> (like Shopify Dawn) or <button aria-expanded> paired with a standard <ul><li><a> list rather than role='menu', which requires complex roving tabindex and arrow-key scripting.

Fix aria-required-children in other stacks

More Shopify Liquid guides