Skip to content

Clarifying the allowed roles on an li element #1368

Closed

Description

@scottaohara

ARIA in HTML is clarifying the allowed roles on li elements.

No role if the parent list element has an implicit or explicit list role.

Otherwise, any role.
NOTE: See ul, ol, or menu for allowed roles for list elements.

This update disallows any role on an li element so long as it is a child of a ul, ol or menu element and that element is exposed as an implicit or explicit role=list. Specifying a role of listitem on an li would produce a warning for unnecessary use of a redundant role.

However, if the parent ul, ol or menu has had its implicit list role overwritten, then the li may have any role so long as that role is an allowed role of its ancestor elements.

For example, the following li may have a role=button specified as the parent list element as a role=none

<ul role=none>
  <li role="button" ...>...</li>
</ul>

However, as the following ul has a role=menu specified, the role=button is not allowed. The only allowed roles for the li would be menuitem, menuitemcheckbox or menuitemradio.

<ul role=menu>
  <li role=button>...</button>
</ul>

similar to the following, as while the ul has a role=none, it is a child of a role=tablist, so therefor the li may only have a role that is an expected descendant of a tablist.

<div role=tablist>
  <ul role=none>
    <li role=button>...</li>
  </ul>
</div>

Finally, even though the following would be flagged for invalid HTML, the li is again allowed any role as it is exposed as a generic role when not correctly nested within a list element:

<article>
   ....
   <li role=paragraph>...</li>
   ...
</article>

Additional test cases provided here.

Activity

  1. sideshowbarker commented on Nov 30, 2025

    @sideshowbarker
    Member

    However, as the following ul has a role=menu specified, the role=button is not allowed. The only allowed roles for the li would be menuitem, menuitemcheckbox or menuitemradio.

    <ul role=menu>
      <li role=button>...</button>
    </ul>

    Can you point me to exactly where in the ARIA in HTML that requirement is stated?

    At https://w3c.github.io/html-aria/#el-li the complete relevant requirements are in full:

    No role other than listitem, which is NOT RECOMMENDED, if the parent list element has an implicit or explicit list role.

    Otherwise, any role if the parent list element does not expose an implicit or explicit list role.

    Based just on those cited requirements, I would expect that li is allowed to have any role — per the “the parent list element does not expose an implicit or explicit list role” condition.

    What am I missing?

    similar to the following, as while the ul has a role=none, it is a child of a role=tablist, so therefor the li may only have a role that is an expected descendant of a tablist.

    <div role=tablist>
      <ul role=none>
        <li role=button>...</li>
      </ul>
    </div>

    For that also, could you point me to exactly where in the ARIA in HTML that requirement is stated?

    …because based just on the li requirements above cited from the spec, I’d expect that li is allowed to have any role.

  2. pkra commented on Dec 1, 2025

    @pkra

    Can you point me to exactly where in the ARIA in HTML that requirement is stated?

    It follows from ARIA: button is not an Allowed Accessibility Child Role for menu, cf. https://w3c.github.io/aria/#menu

  3. sideshowbarker commented on Dec 1, 2025

    @sideshowbarker
    Member

    Can you point me to exactly where in the ARIA in HTML that requirement is stated?

    It follows from ARIA: button is not an Allowed Accessibility Child Role for menu, cf. w3c.github.io/aria#menu

    OK, thanks — but I think those additional requirements should rightly also be explicitly stated (or referenced) in the ARIA in HTML spec too — at point of use at https://w3c.github.io/html-aria/#el-li.

    I think the omission of an explicit such statement or reference at point of use in the ARIA in HTML spec would (mis)lead other checker implementors (not just me) into reasonably assuming that the requirements stated at that point in the ARIA in HTML spec are a complete statement of all the requirements.

  4. pkra commented on Dec 1, 2025

    @pkra

    @sideshowbarker I think this is primarily covered in Section 5 https://w3c.github.io/html-aria/#allowed-descendants-of-aria-roles

    However aria-in-html does not seem to use the current ARIA language (after w3c/aria#1454). I filed w3c/html-aria#561 to try to match this in aria-in-html.

  5. sideshowbarker commented on Dec 1, 2025

    @sideshowbarker
    Member

    @sideshowbarker I think this is primarily covered in Section 5 w3c.github.io/html-aria#allowed-descendants-of-aria-roles

    Ah indeed — thanks much, that looks like what I need.

    However aria-in-html does not seem to use the current ARIA language (after w3c/aria#1454). I filed w3c/html-aria#561 to try to match this in aria-in-html.

    Subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions