listitem role can be used to identify an item inside a list of items. It is normally used in conjunction with the
list role, which is used to identify a list container.
<section role="list"> <div role="listitem">List item 1</div> <div role="listitem">List item 2</div> <div role="listitem">List item 3</div> </section>
Any content that consists of an outer container with a list of elements inside it can be identified to assistive technologies using the
listitem containers respectively.
There are no hard and fast rules about which elements you should use to mark up the list and list items, but you should make sure that the list items make sense in the context of a list, e.g. a shopping list, recipe steps, driving directions.
A list of items. Elements with role
listmust have one or more elements with the role
listitemas children, a one or more elements with the role of
groupthat have one or more elements with the
listitemrole as children.
A collection of related objects, limited to list items when nested in a list, not important enough to have their own place in a pages table of contents.
<ul> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> </ul>
or use an ordered list if the order of the list items matters:
<ol> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> </ol>
Note: The ARIA
listitem roles don't distinguish between ordered and unordered lists.
Note: Styling a list with
list-style: none; in CSS removes the list semantics. Adding
role="listitem" returns the semantics.
|Accessible Rich Internet Applications (WAI-ARIA) |