daisy / ace

Ace by DAISY, an Accessibility Checker for EPUB
MIT License
76 stars 22 forks source link

Unique role rule fires when aria-labelledby points to unique elements. #303

Closed seanharrison closed 4 years ago

seanharrison commented 4 years ago

Please provide the following details if possible or relevant:

Here is a snippet from the error output in the JSON report:

        {
          "@type": "earl:assertion",
          "earl:result": {
            "earl:outcome": "fail",
            "dct:description": "The landmark must have a unique aria-label, aria-labelledby, or title to make landmarks distinguishable",
            "earl:pointer": {
              "cfi": [
                "/4/2[ch66_sec_001]/60[ch66_sec_002]",
                "/4/2[ch66_sec_001]/70[ch66_sec_003]",
                "/4/2[ch66_sec_001]/94[ch66_sec_004]"
              ],
              "css": [
                "#ch66_sec_002",
                "#ch66_sec_003",
                "#ch66_sec_004"
              ]
            },
            "html": "<aside xmlns=\"http://www.w3.org/1999/xhtml\" id=\"ch66_sec_002\" class=\"tip\" aria-labelledby=\"ch66_h1_002\" role=\"complementary\"> <!--##--> <aside xmlns=\"http://www.w3.org/1999/xhtml\" id=\"ch66_sec_003\" class=\"tip\" aria-labelledby=\"ch66_h1_003\" role=\"complementary\"> <!--##--> <aside xmlns=\"http://www.w3.org/1999/xhtml\" id=\"ch66_sec_004\" class=\"tip\" aria-labelledby=\"ch66_h1_004\" role=\"complementary\">"
          },
          "earl:assertedBy": "aXe",
          "earl:mode": "automatic",
          "earl:test": {
            "earl:impact": "moderate",
            "dct:title": "landmark-unique",
            "dct:description": "Landmarks must have a unique role or role/label/title (i.e. accessible name) combination",
            "help": {
              "url": "http://kb.daisy.org/publishing/",
              "dct:title": "(no specific entry)",
              "dct:description": "Ensures landmarks are unique"
            },
            "rulesetTags": [
              "cat.semantics",
              "best-practice"
            ]
          }
        }

However:

I conclude that DAISY Ace is erroneously raising this issue; perhaps it isn't processing the aria-labelledby attributes as though it were a title or aria-label?

rdeltour commented 4 years ago

Thanks for the report, and the thorough inspection of your content! Would it be possible to share an EPUB to help us reproduce the error?

arthompson-koganpage commented 4 years ago

EPUB and DAISY Ace report: https://koganpage.box.com/s/q9gif8e4r2cov8odssmqg8q909a35gb8.

danielweck commented 4 years ago

Thank you for sharing the EPUB! I ran the a11y evaluation with the latest version of Ace shipped in Ace App (v1.2.0-beta.6). (NPM https://www.npmjs.com/package/@daisy/ace/v/1.2.0-beta.6 built from PR https://github.com/daisy/ace/pull/236 )

I am getting the same report:

        {
          "@type": "earl:assertion",
          "earl:result": {
            "earl:outcome": "fail",
            "dct:description": "The landmark must have a unique aria-label, aria-labelledby, or title to make landmarks distinguishable",
            "earl:pointer": {
              "cfi": [
                "/4/2[ch66_sec_001]/60[ch66_sec_002]",
                "/4/2[ch66_sec_001]/70[ch66_sec_003]",
                "/4/2[ch66_sec_001]/94[ch66_sec_004]"
              ],
              "css": [
                "#ch66_sec_002",
                "#ch66_sec_003",
                "#ch66_sec_004"
              ]
            },
            "html": "<aside xmlns=\"http://www.w3.org/1999/xhtml\" id=\"ch66_sec_002\" class=\"tip\" aria-labelledby=\"ch66_h1_002\" role=\"complementary\"> <!--##--> <aside xmlns=\"http://www.w3.org/1999/xhtml\" id=\"ch66_sec_003\" class=\"tip\" aria-labelledby=\"ch66_h1_003\" role=\"complementary\"> <!--##--> <aside xmlns=\"http://www.w3.org/1999/xhtml\" id=\"ch66_sec_004\" class=\"tip\" aria-labelledby=\"ch66_h1_004\" role=\"complementary\">"
          },
          "earl:assertedBy": "aXe",
          "earl:mode": "automatic",
          "earl:test": {
            "earl:impact": "moderate",
            "dct:title": "landmark-unique",
            "dct:description": "Landmarks must have a unique role or role/label/title (i.e. accessible name) combination",
            "help": {
              "url": "http://kb.daisy.org/publishing/docs/script/aria.html",
              "dct:title": "ARIA",
              "dct:description": "Ensures landmarks are unique"
            },
            "rulesetTags": [
              "cat.semantics",
              "best-practice"
            ]
          }
        }
rdeltour commented 4 years ago

I reviewed the EPUB, and I don’t think the report is erroneous.

The uniqueness rule applies to the landmarks’ accessible name. In other words, it’s not the labelling element that should be unique, but its content. The idea is that a screen reader can expose a list of landmark titles to the user, for quick navigation. If all these titles are identical, the user doesn’t know where to navigate.

In the shared EPUB, many landmarks end up having the same accessible name. For instance, in 11_chapter01.xhtml line 16:

<aside id="ch01_sec_003" class="tip" aria-labelledby="ch01_h1_003" role="complementary">
<p id="ch01_h1_003" class="title" epub:type="title">Words of wisdom</p>

and line 29:

<aside id="ch01_sec_005" class="tip" aria-labelledby="ch01_h1_005" role="complementary">
<p id="ch01_h1_005" class="title" epub:type="title">Words of wisdom</p>

Even if both aside elements are labelled by different elements, the resulting accessible name is the same, "Words of wisdom", which wouldn’t differentiate them in a navigation by landmarks.

Possible solutions can be:

Note that from a recent screen reader usage survey by WebAIM, even though under 3% of users prefer landmarks-based navigation to headings-based navigation, some 26% of screen reader users do navigate by landmarks often when they're available, and 56% sometimes. This survey is primarily about the Web, so I don’t know to which extent it can be extrapolated to ebooks, but still. For this reason, I wouldn't particularly recommend the first option (even if it might meet some level of WCAG conformance, it's not the most accessible).

seanharrison commented 4 years ago

My apologies for the false alarm — you are right, the aria-labelledby text for the landmarks is not unique in our EPUB. I thought it was when I posted the issue, but I hadn't checked carefully enough.

rdeltour commented 4 years ago

My apologies for the false alarm

No problem, you're welcome :-)