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

Add note to invalid IdRef value error that it may be due to a Shadow DOM boundary #3419

Closed
joppekroon opened this issue Mar 22, 2022 · 4 comments
Labels
pr A pr has been created for the issue rule metadata Issues in the rule metadata code (lib/rules)
Milestone

Comments

@joppekroon
Copy link

Product: axe-core

Expectation: Indicate that the referenced id is located beyond a Shadow DOM boundary. Even a message that states that this may be potentially the reason of the error would be very helpful.

Actual: Indicates that the value of the IdRef attribute is invalid

    "ARIA attributes must conform to valid values (aria-valid-attr-value)"

    Fix all of the following:
      Invalid ARIA attribute value: aria-controls="id-in-shadow"

Motivation: It is currently quite a confusing error message if you're not acutely aware that referencing an id that is located on the other side of a Shadow DOM boundary is problematic.


axe-core version: 4.2.0
@straker
Copy link
Contributor

straker commented Mar 22, 2022

Interesting. I can understand what you mean, but this may be extremely difficult to figure out. We currently only check if the id is found using document.getElementById, and will flag it as invalid if that doesn't return anything. I'm not sure we could tell if that was because it was in a shadow tree or because it wasn't found on the page at all.

@straker straker added the needs discussion More discussion is needed to continue label Mar 22, 2022
@joppekroon
Copy link
Author

I wouldn't be surprised if it is unfeasible to figure out for sure that the IdRef and Id are on opposite sides of a Shadow DOM boundary, although it would be excellent service if you could.

However, a simple note in the error for an invalid IdRef that it may be caused by a Shadow DOM boundary would already prevent someone from giving up and disabling the test altogether. Or in my case, prevent someone from digging through the axe-core code to figure out the bug before finally having a facepalm moment after way too long spent on this 😉.

@straker
Copy link
Contributor

straker commented Mar 22, 2022

Adding a note in the message sounds doable

@straker straker added rule metadata Issues in the rule metadata code (lib/rules) and removed needs discussion More discussion is needed to continue labels Mar 22, 2022
@straker straker added the pr A pr has been created for the issue label Mar 22, 2022
@straker straker added this to the Axe-core 4.5 milestone Apr 12, 2022
@WilcoFiers WilcoFiers modified the milestones: Axe-core 4.5, Axe-core 4.6 May 20, 2022
@padmavemulapati
Copy link

Validated with the latest develop branch axe-core code base,
test snippet is:

<div></div>
  <button id="target1" aria-describedby="test1">Button1</button>
  <div></div>
  <button id="target2" aria-labelledby="test2">Button2</button>

so that the failure message now is:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr A pr has been created for the issue rule metadata Issues in the rule metadata code (lib/rules)
Projects
None yet
Development

No branches or pull requests

4 participants