Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Accessibility
  3. ARIA
  4. ARIA reference
  5. Roles
  6. listitem

ARIA: listitem role

The ARIAlistitem role can be used to identify an item inside a list of items. It is normally used in conjunction with thelist role, which is used to identify a list container.

html
<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>

Description

Any content that consists of an outer container with a list of elements inside it can be identified to assistive technologies using thelist andlistitem 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.

Note:If at all possible in your work, you should use the appropriate semantic HTML elements to mark up a list and its listitems —<ul>/<ol> and<li>. SeeBest practices for a full example.

Associated WAI-ARIA Roles, States, and Properties

list

A list of items. Elements with rolelist must have one or more elements with the rolelistitem as children, a one or more elements with the role ofgroup that have one or more elements with thelistitem role as children.

group

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.

Best practices

Only userole="list" androle="listitem" if you have to — for example if you don't have control over your HTML but are able to improve accessibility dynamically after the fact with JavaScript.

If at all possible, you should use the appropriate semantic HTML elements to mark up a list and listitems —<ol>,<ul> and<li>. For example, our above example should be rewritten as follows:

html
<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:

html
<ol>  <li>List item 1</li>  <li>List item 2</li>  <li>List item 3</li></ol>

Note:The ARIAlist /listitem roles don't distinguish between ordered and unordered lists.

Note:Styling a list withlist-style: none; in CSS removes the list semantics. Addingrole="listitem" returns the semantics.

Note:If you are marking up a list of items that will function as a tabbed interface, you should instead use thetab,tabpanel, andtablist roles.

Specifications

Specification
Accessible Rich Internet Applications (WAI-ARIA)
# listitem

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp