How to Fix List Structure Errors in HTML (ul, ol, dl)

Screen readers announce lists as "list, 5 items" only when the HTML is built correctly. Common failures include a <div> or <a> placed directly inside a <ul>, an <li> with no list parent, or a <dl> containing loose <p> tags. By the end of this guide you will have found every malformed list, fixed the markup or ARIA roles, and confirmed that the four related checks pass: list, listitem, definition-list and dlitem.

By Updated ⏱ 20-40 minutes🎯 Beginner● Low impactAccessibility
Illustration: Lists structured correctly fix guide
ACCESSIBILITY · FIX GUIDE Lists structured correctly IMPACTEFFORT TIME20-40 minutes LEVELBeginner

Why it matters

Assistive technology uses list semantics to tell users how many items a group holds and to let them skip past it. Broken lists in navigation menus, product features or FAQ blocks may be read as one run-on string or as unrelated fragments, which makes the page harder to scan for keyboard and screen reader users. The SEO impact is small.

Clean list markup does help search engines and AI parsers pull out steps, feature lists and term/definition pairs accurately. 1 Info and Relationships.

✕Before<ul class="nav"><div class="item"><ahref="/shop">Shop</a></div></ul> — a<div> sits directly inside <ul>, so✓After<ul class="nav"><li class="item"><ahref="/shop">Shop</a></li></ul> — only<li> elements are direct children of

What you need

Access to your theme templates, components or page builder
Chrome or Firefox with the axe DevTools extension (free) or Lighthouse
A list of the URLs flagged by the audit

Step-by-step fix

1

Locate every failing list on the page

Open a flagged URL in Chrome, open DevTools (F12) and go to the axe DevTools tab. Run Scan all of my page, then filter by the rules list, listitem, definition-list and dlitem. Click Highlight on each issue to jump to the element, and note which template or component outputs it.

That is usually the header menu, footer, breadcrumb or a feature grid.

Pro tip: Fix the template, not the page. One header partial often accounts for every failure across the whole site.
2

Remove non-li children from ul and ol

A <ul> or <ol> may only have <li>, <script> or <template> as direct children. Move any <div>, <span>, <a>, <p>, heading or <button> inside an <li>, or turn the wrapper itself into the <li>. Comments and whitespace are fine.

html
<!-- Wrong -->
<ul class="features">
  <h3>Features</h3>
  <div class="feature">Free shipping</div>
  <a href="/returns">30-day returns</a>
</ul>

<!-- Right -->
<h3>Features</h3>
<ul class="features">
  <li class="feature">Free shipping</li>
  <li><a href="/returns">30-day returns</a></li>
</ul>
Pro tip: Moving the class from the old <div> to the <li> keeps your CSS working. Reset browser defaults with `list-style: none; padding: 0; margin: 0;` if needed.
3

Give orphaned li elements a list parent

Every <li> must sit directly inside a <ul>, an <ol>, or an element with role="list". Orphans usually come from a component that renders <li> items into a <div> or <nav>. Either wrap them in a <ul>, or change them to <div> if the content is not really a list.

html
<!-- Wrong -->
<nav class="breadcrumb">
  <li><a href="/">Home</a></li>
  <li><a href="/blog">Blog</a></li>
</nav>

<!-- Right -->
<nav class="breadcrumb" aria-label="Breadcrumb">
  <ol>
    <li><a href="/">Home</a></li>
    <li><a href="/blog">Blog</a></li>
  </ol>
</nav>
4

Fix ARIA roles that break list semantics

Some roles on a list or its items cause failures:

  • role="none" or role="presentation" on a <ul> strips its list role, so every <li> inside becomes an orphan.
  • role="navigation" or role="menubar" on a <ul> does the same thing to its items.
  • A role on an <li> such as role="button" makes it an invalid child of <ul>.

Put navigation semantics on a wrapping <nav> and let the <ul>/<li> stay plain. If you must use divs, pair role="list" with role="listitem".

html
<!-- Wrong -->
<ul role="navigation">
  <li><a href="/pricing">Pricing</a></li>
</ul>

<!-- Right -->
<nav aria-label="Main">
  <ul>
    <li><a href="/pricing">Pricing</a></li>
  </ul>
</nav>

<!-- Acceptable div-based list -->
<div role="list">
  <div role="listitem">Free shipping</div>
</div>
Pro tip: Only use role="menu" or role="menubar" if you also implement full arrow-key handling. Most site navigation should be a plain list of links.
5

Repair definition lists (dl, dt, dd)

A <dl> may only contain <dt> and <dd> groups, optionally each group wrapped in a single <div>, plus <script> or <template>. Every <dt> needs at least one <dd> after it. Every <dt> and <dd> must sit inside a <dl>, either directly or through one of those <div> wrappers.

Move stray headings or paragraphs out of the <dl> or into a <dd>.

html
<!-- Wrong -->
<dl class="specs">
  <p>Specifications</p>
  <dt>Weight</dt>
  <span>1.2 kg</span>
</dl>
<dd>Orphaned value</dd>

<!-- Right -->
<h3>Specifications</h3>
<dl class="specs">
  <div>
    <dt>Weight</dt>
    <dd>1.2 kg</dd>
  </div>
  <div>
    <dt>Material</dt>
    <dd>Recycled aluminium</dd>
  </div>
</dl>
Pro tip: If the content is not truly term/value pairs, for example an FAQ accordion, use headings with paragraphs or <details>/<summary> instead of a <dl>.
6

Fix list markup inside loops and components

In component frameworks the outer <ul> often lives in one file and the items in another, so a wrapper <div> slips in between. Make the item component return the <li> itself. Avoid extra wrappers such as a styled <div> or an animation container around each item.

javascript
// Wrong: ProductCard renders <div class="card"> inside <ul>
<ul className="grid">
  {products.map(p => <ProductCard key={p.id} product={p} />)}
</ul>

// Right: wrap each card in an <li>
<ul className="grid">
  {products.map(p => (
    <li key={p.id}>
      <ProductCard product={p} />
    </li>
  ))}
</ul>
Pro tip: Animation libraries such as Framer Motion can render <motion.li>. Use that instead of wrapping each <li> in a <motion.div>.
7

Re-test and confirm the fix

Clear any page or CDN cache, reload the URL and run the axe DevTools scan again. The list, listitem, definition-list and dlitem issues should be gone. Repeat on one URL per template type (home, category, product, article), then re-run the site audit.

text
npx @axe-core/cli https://example.com --rules list,listitem,definition-list,dlitem
Pro tip: Add the same axe command to your CI pipeline so new components can't reintroduce broken lists.

Platform-specific notes

WordPress

Core List blocks and wp_nav_menu() output valid markup. Failures usually come from page builders or custom walkers. Check your Walker_Nav_Menu start_el() for <div> output. In Elementor or Divi icon-list widgets, open the widget in the editor and confirm the HTML in the browser. Some third-party widgets use <ul> with <div> children, and the fix there is to switch widgets or override the template in a child theme.

Shopify

Edit via Online Store > Themes > ... > Edit code. Menus are rendered in sections/header.liquid or snippets such as header-drawer.liquid. Look inside {% for link in linklist.links %} loops for <div> or <a> output directly inside a <ul>. Dawn-based themes are mostly valid, but app-injected blocks (reviews, badges) can add non-li children.

Webflow

Use the List and List Item elements from the Add panel rather than Div Blocks. Collection Lists render div role="list" with div role="listitem" items, which passes. Don't add a custom role attribute to a Collection List Wrapper or Item in Element Settings > Custom attributes, because that breaks it.

Wix

Wix generates most list markup and offers no raw HTML control. Use the Text element's bullet or number list buttons instead of typed dashes. Failures inside Wix apps can't be fixed directly, so report them to Wix or replace the app. In Wix Studio, custom code embeds must follow the HTML rules above.

Next.js / React

Fragments (<>...</>) inside a <ul> are fine because they render nothing. Wrapping items in a <div> or a styled-components wrapper is not fine. Check each item component's root element. eslint-plugin-jsx-a11y can't catch every nesting issue across components, so run @axe-core/react or Playwright with @axe-core/playwright in tests.

Check that it worked

✅ How to verify

  • Run axe DevTools on the page and confirm no issues remain for list, listitem, definition-list or dlitem.
  • In Chrome DevTools, open Elements > Accessibility pane on the <ul>. It should show role "list", and each child should show role "listitem".
  • Turn on a screen reader (VoiceOver: Cmd+F5 on macOS, or NVDA on Windows) and arrow onto the list. It should announce "list, N items".
  • Run Lighthouse > Accessibility and confirm the audits for list, list items and definition list elements are under Passed audits.

⚠️ Common mistakes

  • Adding role="presentation" to a <ul> to remove bullet styling, which orphans every <li>. Use CSS list-style: none instead.
  • Fixing the rendered HTML on one page in the CMS editor while the broken markup actually comes from a shared header or footer template.
  • Placing a heading or 'View all' link directly inside a <ul> as a list title. Put it before the list, or inside its own <li>.
  • Wrapping <dt>/<dd> pairs in <span>, <section> or several nested <div>s. Only one plain <div> per group is allowed inside a <dl>.

Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.

Check my site free

FAQ

Can I put a div inside a ul?

Not as a direct child. A <ul> or <ol> may only directly contain <li>, <script> and <template>. You can put a <div> inside an <li>, so wrap it or change the <div> into the <li>.

Is a nested list inside an li valid?

Yes. A <ul> or <ol> placed inside an <li> is the correct way to build sub-menus and nested lists. Just make sure the nested list's own children are <li> elements.

Does Safari VoiceOver still drop list semantics with list-style: none?

WebKit removes the list role from <ul>/<ol> styled with list-style: none in some contexts, unless the list is inside a <nav>. If list announcement matters there, add role="list" to the <ul>. This is valid and does not trigger the list checks.

Do broken lists affect SEO rankings?

Not directly; Google does not penalise invalid list nesting. Well-formed <ol>, <ul> and <dl> markup does make it easier for search engines and AI answer tools to extract steps, feature lists and specifications from your content.