axe-core icon indicating copy to clipboard operation
axe-core copied to clipboard

axe-code is not reporting duplicated links on a page (link-name)

Open djalmaaraujo opened this issue 2 years ago • 5 comments

Product

axe-core

Product Version

4.7.2

Latest Version

  • [X] I have tested the issue with the latest version of the product

Issue Description

Expectation

axe-core should report duplicated links on the page, based on https://dequeuniversity.com/rules/axe/4.7/link-name.

Actual

axe-code is not reporting duplicated links on the page, based on https://dequeuniversity.com/rules/axe/4.7/link-name.

How to Reproduce

Code sample: https://codesandbox.io/s/patient-worker-x7shvk?file=/index.html

  1. Open https://codesandbox.io/s/patient-worker-x7shvk?file=/index.html
  2. Try to open the link directly (https://x7shvk.csb.app/), without all the CodeSandbox UI
  3. Run axe DevTools
  4. You should get some issues, but no mention of the duplicated links mentioned in https://dequeuniversity.com/rules/axe/4.7/link-name

VoiceOver shows the issue visually:

IMG_3164

Additional context

Here are the screenshots I took from the report in our application:

  • axe results
  • Voice-over links
  • code/visual

image (1) image (2) image test

djalmaaraujo avatar Sep 26 '23 15:09 djalmaaraujo

Thanks for the issue. So the link-name rule does not check if the name of the link is a duplicate. It only checks if the link has an accessible name (regardless of what it is).

The rule identical-links-same-purpose does however check the name of the links and verifies that each link that uses the same name also points to the same URL. It only returns Needs Review items though so you won't seem them as violations.

straker avatar Sep 26 '23 15:09 straker

Thanks for the issue. So the link-name rule does not check if the name of the link is a duplicate. It only checks if the link has an accessible name (regardless of what it is).

The rule identical-links-same-purpose does however check the name of the links and verifies that each link that uses the same name also points to the same URL. It only returns Needs Review items though so you won't seem them as violations.

Thank you for the fast response. Does the sentence below deserve a review?

"Link text and alternate text for images, when used as links, must be discernible by a screen reader, must not have a duplicate label, and must be focusable."

It says "not have a duplicated label". Is that referring to links or inputs?

djalmaaraujo avatar Sep 26 '23 17:09 djalmaaraujo

Oh you're right. How interesting. I believe that is a doc error on our end as the rule definitely does not check for duplicate labels.

straker avatar Sep 26 '23 17:09 straker

Awesome @straker! Thanks for working on this and providing fast feedback!

But I wonder why this is not a WCAG rule. It's clear that once you open the VoiceOver menu, you get a lot of "Edit" "Edit" "Edit". It's too confusing to the final user.

image

djalmaaraujo avatar Sep 26 '23 18:09 djalmaaraujo

I agree. Success Criterion 2.4.4 is intended to ensure that links can be understood from context alone, however axe-core is unable to determine programmatically if any link text would fail that part of the success criterion. Axe-core does not and cannot fully satisfy most success criterion due to needing human judgement call for some parts.

straker avatar Oct 04 '23 14:10 straker