Skip to content
ShopifyRule: list•Reviewed Oct 2026

Ensure ul and ol list containers only contain li elements in Shopify

`<ul>` and `<ol>` tags must contain only `<li>` elements, `<script>`, or `<template>` tags.

What's wrong

Placing `<div>` directly inside `<ul>` breaks list semantics and item numbering.

Who it affects

Screen readers announce incorrect item counts or stop announcing list structure.

How to fix on Shopify

Move wrapping containers inside the `<li>` tag in collection and navigation loops.

Code example

Problematic Code
LIQUID
<ul class="product-grid">
  <div class="grid-row">
    <li>Product 1</li>
  </div>
</ul>
Recommended Accessible Code
LIQUID
<ul class="product-grid">
  <li class="product-grid__item">
    <div class="product-card">Product 1</div>
  </li>
</ul>

How to check your fix

Validate HTML using W3C validator or DevTools to verify all direct children of `<ul>` and `<ol>` are `<li>` tags.

Check if your site has this issue

Scan any public store page free against WCAG 2.2 AA in 30 seconds.

Your session has ended

Sign in again to carry on. Anything you typed on this page is kept.

Signed in another way? Use another method (opens a new tab)