Skip to main content
🎉 A11y Issue Detection Agent is now live! Detect accessibility issues like a WCAG expert with AI. Try now!
No Result Found
Connect and get help from 7,000+ developers on our Discord community. Ask the CommunityAsk the Community

listitem

Severity: Serious

Description

<li> (list item) elements must be contained within a <ul> (unordered list) or <ol> (ordered list) parent element. Using <li> outside of these list containers breaks the semantic structure of the list. Screen readers rely on proper list structure to announce the number of items in a list and to allow users to navigate between list items efficiently.

Example

In the following example, <li> elements are placed inside a <div> instead of a <ul> or <ol>. Screen readers cannot identify these as list items or convey the list structure to users, breaking the listitem rule.

Incorrect sample - li elements outside a ul or ol
Copy icon Copy

In contrast, the following code snippet wraps all <li> elements in a <ul> element. Screen readers correctly identify this as a list and can announce the number of items, and the code does not break the listitem rule.

Correct sample - li elements inside a ul
Copy icon Copy

How to fix?

Check if your site uses <li> elements outside of a <ul> or <ol> container. If so:

  • Wrap the <li> elements in a <ul> element if the list is unordered (for example, navigation links or feature lists). This is the recommended solution.
  • Wrap the <li> elements in an <ol> element if the order of items is meaningful (for example, steps in a process).
  • If you are using <li> purely for styling and the items do not represent a list, replace them with semantically appropriate elements such as <p> or <span>.

Reference

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle