-
-
Notifications
You must be signed in to change notification settings - Fork 314
Description
ARIA in HTML is clarifying the allowed roles on li elements.
No
roleif the parent list element has an implicit or explicitlistrole.Otherwise, any
role.
NOTE: Seeul,ol, ormenufor 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.