Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listitem rule fails with roles inheriting from the 'list' or 'listitem' roles #1677

Closed
rdeltour opened this issue Jul 8, 2019 · 8 comments
Closed
Labels
fix Bug fixes rules Issue or false result from an axe-core rule

Comments

@rdeltour
Copy link
Contributor

rdeltour commented Jul 8, 2019

Expectation: Axe would not report a failure to the rule listitem when native list elements (ol,ul,li) declare a more specific role inheriting from their native role (e.g. role="directory" on ul, role="doc-biblioentry on li, etc.).

Actual: the rule listitem fails.

Motivation: even if some of those roles may have limited accessibility support (like the DPUB roles), using them on elements with native list semantics is an appropriate fallback and should pass the rule.


axe-core version: 3.2.2

Example 1 of markup that will fail the rule listitem

<ul>
  <li role="doc-biblioentry">an entry</li></ul>

Example 2 of markup that will fail the rule listitem

<ol role="directory">
   <li><a href="preface_001.xhtml">Original Transcriber’s Notes:</a></li>
   <li><a href="introduction_001.xhtml">ETYMOLOGY.</a></li>
   <li><a href="epigraph_001.xhtml">EXTRACTS (Supplied by a Sub-Sub-Librarian).</a></li>
   <li><a href="chapter_001.xhtml">Chapter 1. Loomings.</a></li></ol>
@rdeltour
Copy link
Contributor Author

rdeltour commented Jul 8, 2019

If you agree this is a false-positive, I can submit at PR 😊

@straker
Copy link
Contributor

straker commented Jul 9, 2019

Sounds good to me, a PR would be great! Just to be clear, did you mean that

<ul>
  <li role="doc-biblioentry">an entry</li></ul>

fails the list rule?

@WilcoFiers
Copy link
Contributor

Totally agreed, although I'm not sure there's an obvious fix for it. Axe-core doesn't have a good representation of the ARIA role hierarchy. If you find it's going to be a complicated fix, please put together a proposal. Don't want to waste a whole bunch of time and then find out there's some (possibly unrelated) edge case that makes it not work.

@straker straker added fix Bug fixes rules Issue or false result from an axe-core rule labels Jul 9, 2019
@rdeltour
Copy link
Contributor Author

rdeltour commented Jul 9, 2019

@straker

did you mean that (…) fails the list rule?

Yes, that one would fail the list rule (only-list-items check), and the other example I gave in the OP would fail the listitem rule (listitem check).

@WilcoFiers

I'm not sure there's an obvious fix for it. Axe-core doesn't have a good representation of the ARIA role hierarchy.

In our local patches to Axe we used the axe.commons.aria.getRoleType(role) API, which is based on the lookup table. It may not be perfect (i.e. will not support transitive inheritance) but should be enough in this case?
See our patch for the only-list-items check and our patch for the listitem check.

@straker
Copy link
Contributor

straker commented Jul 9, 2019

There are other role types that aren't listitem that can be used on <li> items that will still fail the list rule (e.g. menuitemradio, menuitemcheckbox). Would it be possible to use the aria.isAriaRoleAllowedOnElement api to see if the role is allowed on the element instead of just looking at listitem type roles?

@WilcoFiers
Copy link
Contributor

@rdeltour I was just reviewing this ACT-R rules:
https://github.com/act-rules/act-rules.github.io/pull/255/files

I started digging a little, and according to dpub-aria, doc-biblioentry has doc-bibliography as a required context, so a ul without role="doc-bibliography" should fail, no?

@rdeltour
Copy link
Contributor Author

I started digging a little, and according to dpub-aria, doc-biblioentry has doc-bibliography as a required context, so a ul without role="doc-bibliography" should fail, no?

Yes, I think it should fail.

@WilcoFiers
Copy link
Contributor

Looking at this again. At this point both directory and doc-biblioentry are proposed to be deprecated, exactly for the reason that its inheritance creates confusion. Neither of these use cases is valid according to ARIA 1.1, so we're going to leave these as failures for axe-core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fixes rules Issue or false result from an axe-core rule
Projects
None yet
Development

No branches or pull requests

3 participants