Valid children in list elements

Last updated:

How to fix this issue?

Place only <li>, <script>, or <template> elements as direct children of <ul> or <ol>:

CORRECT:
<ul>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
</ul>
CORRECT:

script and template are allowed

<ul>
  <li>First item</li>
  <script>/* ... */</script>
  <template>...</template>
</ul>

If you need to add extra markup around list items, move that markup inside the <li> element:

BAD:
<ul>
  <div>
    <li>First item</li>
  </div>
</ul>
CORRECT:
<ul>
  <li>
    <div>First item</div>
  </li>
</ul>

Why is this important?

Screen readers announce the number of items in a list to help users navigate. Invalid child elements break the list structure, which causes screen readers to report incorrect information or skip items entirely.

More info:

WCAG 1.3.1 Info and Relationships.

Rule info

Standard

WCAG A SC 1.3.1

Regulations

EN 301 549 RGAA EAA AODA

User impact

Fix complexity

Affects

Was this article helpful?

Checkout the ExcellentWebCheck services

ExcellentWebCheck's goal is to improve the online user experience. The tools of ExcellentWebCheck help to detect and improve usability problems on your website.