squirrelscan
GitHub

Orphaned li: list items outside ul, ol or menu

An li whose parent is not a list is announced as a plain block of text. squirrel checks the immediate parent of every list item.

What an orphaned list item is

An <li> gets its meaning from the list around it. Outside one, the browser exposes it as a generic container: no item count, no position, no way to move between siblings with a screen reader shortcut.

It usually happens when a wrapper is inserted for layout, or when a component renders items without rendering the list.

What squirrel checks

One check, listitem, at severity error. For every <li> it reads the immediate parent.

  • Fail when that parent is not <ul>, <ol>, <menu> or an element with role="list". Report message: N li element(s) not inside a list. Items read li#step-2, or li: "Enter your email add..." quoting the first 20 characters of the text, up to ten with a count of the rest.
  • Pass with N list item(s) are inside lists.
  • Info with No li elements found.

Only the immediate parent counts. A <div> between the <ul> and its items is reported here, while a11y/aria-required-parent walks the whole ancestor chain and lets it through.

How to fix it

<ul class="grid">
  <li>Team</li>
  <li>Business</li>
</ul>

Delete the wrapper and style the <ul> directly. CSS grid and flexbox both work on a list element, so the wrapper is rarely doing anything the list cannot.

Where a component renders one item, move the <ul> up into the parent that renders the collection, so every item is emitted inside a list.

Rule IDa11y/listitem
CategoryAccessibility
ScopePer-page
Severityerror
Weight7/10

Enable / disable

Disable this rule

[rules]
disable = ["a11y/listitem"]

Disable all Accessibility rules

[rules]
disable = ["a11y/*"]

Enable only this rule

[rules]
enable = ["a11y/listitem"]

enable replaces the default ["*"], so this is the only rule selected. Leave disable out: a rule that matches any disable pattern is skipped even when enable names it. Only an enabled setting under a rule’s own [rule_options] table overrides both lists.

Accessibility findings ship in every audit next to the SEO, performance and agent experience rules. See Website security scan with AI for how an agent works through a report.

References

Check your site

Run squirrel audit https://example.com and open the Accessibility section of the report. Each orphan is listed by id, or by the opening words of its text. Signed-out local audits need no account and cost nothing. Signed-in audits spend credits.

Type to search…

↑↓ navigate↵ openesc close