Lists must contain only <li> elements as direct children

A `<ul>` or `<ol>` may only contain `<li>` elements, plus `<script>` and `<template>`, as direct children. Correct structure lets screen readers announce the list and count its items.

Rule IDlist
ImpactSerious
Success criterion 1.3.1 Info and Relationships · A
StandardsWCAG 2.0 · WCAG 2.1 · WCAG 2.2 · Section 508 · EN 301 549
Readabler fix Fixed automatically

Example

Before
<ol class="steps">
  <h3>How to return an item</h3>
  <li>Print your return label.</li>
  <li>Pack the item in its original box.</li>
  <li>Drop it at any post office.</li>
</ol>

A screen reader may miscount the steps or read the heading as part of the list.

After
<h3>How to return an item</h3>
<ol class="steps">
  <li>Print your return label.</li>
  <li>Pack the item in its original box.</li>
  <li>Drop it at any post office.</li>
</ol>

A screen reader reads the heading, then “list, 3 items”, and each step in order.

Why it matters

When a screen reader reaches a list, it says how many items there are and lets the user jump from item to item or skip the list. Blind visitors use that count to decide whether to read on: “list, 3 items” tells them a set of steps is short.

When other elements sit directly inside the <ul> or <ol>, browsers can expose a broken structure. The count may be wrong, the extra content may be announced in odd places, and some screen readers stop treating the element as a list. Voice control users who navigate by list items can be affected too. The page looks fine on screen, so the problem often goes unnoticed.

How to fix it

Keep only <li> (plus <script> and <template>) as direct children of <ul> and <ol>. Everything else goes inside an <li> or outside the list.

Headings and introductions. Put them before the list, as in the example. A sentence that introduces the list, such as “You will need:”, also belongs above it.

Wrappers added for styling or by a framework. Remove the wrapper, or move it inside the <li>:

<ul class="product-grid">
  <li><div class="card">Trail running shoes – $89</div></li>
  <li><div class="card">Merino hiking socks – $18</div></li>
</ul>

Separators and decorations. Draw them with CSS, for example with a border or ::before, instead of adding <span> or text between items.

Nested lists. A sub-list must sit inside an <li>, not between items:

<ul>
  <li>Women
    <ul><li>Jackets</li><li>Boots</li></ul>
  </li>
</ul>

Also check components that render list items, such as menus and pagination, since they often add wrappers you don't see in your templates.

Checklist

  1. Keep only <li> elements directly inside <ul> and <ol>.
  2. Move headings and intro text before the list.
  3. Put wrappers and nested lists inside an <li>.
  4. Draw separators with CSS, not extra elements.

How the check works

The check looks at every <ul> and <ol> without a role attribute. It fails when a direct child is anything other than an <li>, <script> or <template>, or an element with role="listitem", and when the list contains loose text. It passes when every child is allowed. Whether the content really is a list is for you to judge.

Resources

Updated October 27, 2026