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

computeAccessibleName doesn't extract repeated text content from aria-labelledby #815

Open
VinceMalone opened this issue Mar 11, 2022 · 4 comments

Comments

@VinceMalone
Copy link

problem

given the following HTML:

<p id="paragraph">
  hello
  <span id="world">world</span>
</p>

<button aria-labelledby="paragraph world"></button>

I would expect the computed name of the button element to be "hello world world", but computeAccessibleName(button) returns "hello world".

🔗 example test (click "Tests" tab in right panel)

@eps1lon
Copy link
Owner

eps1lon commented Mar 11, 2022

Nodes can only be considered once by spec (i.e. according to ACCNAME). So if we compute the reference #paragraph we get "hello world". But that already includes #world so we can't consider it twice.

The reason for that is that this specification avoids infinite loops.

Source:

Important: Each node in the subtree is consulted only once. If text has been collected from a descendant, but is referenced by another IDREF in some descendant node, then that second, or subsequent, reference is not followed. This is done to avoid infinite loops.

-- https://www.w3.org/TR/2019/WD-accname-1.2-20190711/

Does that make sense?

@VinceMalone
Copy link
Author

I see; I didn't quite know where to look for that information, but I suspected that might be the case. my only concern is that, while that may be defined in the spec, if you test the aforementioned code with most screen readers today, you get the result I was expecting 😕

I tested with:

  • VoiceOver — macOS 12
  • Narrator — Windows 10
  • NVDA — Windows 10
  • TalkBack — Android 11
  • VoiceOver — iOS 15

@eps1lon
Copy link
Owner

eps1lon commented Mar 11, 2022

Let me check again if I misinterpreted something or if this should be brought up with spec authors or implementers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants