Open Bug 1652712 Opened 4 years ago Updated 4 years ago

aria-labelledby ignored when computing accessible name from content

Categories

(Core :: Disability Access APIs, defect, P3)

78 Branch
defect

Tracking

()

People

(Reporter: wilcofiers, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36

Steps to reproduce:

  1. Open a page in Firefox with the following HTML:

<a href="#">
<img src="https://via.placeholder.com/100" aria-labelledby="outside" />
<svg role="img" aria-labelledby="circle" height="100">
<title id="circle">world</title>
<circle cx="50" cy="50" r="40" stroke="black" />
</svg>
</a>
<div id="outside">Hello</div>

  1. Open the accessibility inspector

Actual results:

The accessible name of the link should be "Hello world"

Expected results:

The link has an empty accessible name ("").

A similar issue seems to exist with buttons, which leads me to suspect Firefox does not correctly compute elements that are named from content (https://www.w3.org/TR/wai-aria/#namefromcontent). Specifically, step F.ii.b in the accessible name computation spec is where this is not going right: https://www.w3.org/TR/accname-1.1/#step2F.iii.b

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Accessibility Tools
Product: Firefox → DevTools

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

I can confirm this. Since this seems to be new in Name Comp 1.1, or at least we've never been notified about such a case before AFAIK, setting this to a P3. Jamie, please adjust if you think this should be higher priority.

Blocks: namea11y
Severity: -- → S3
Status: UNCONFIRMED → NEW
Component: Accessibility Tools → Disability Access APIs
Ever confirmed: true
Flags: needinfo?(jteh)
OS: Unspecified → All
Priority: -- → P3
Product: DevTools → Core
Hardware: Unspecified → All

I think p3 is reasonable here. Certainly, I've not seen this in the wild. Note, however, that this works as expected in Chromium.

Simpler test case:
data:text/html,<button><span aria-labelledby="label"></button><div id="label">label

The button should get a name of "label", but it is instead empty.

Fixing this is going to be an interesting challenge, since aria-labelledby is currently handled in Accessible::ARIAName, not within nsTextEquivUtils. I also worry about the possibility of loops and I'm not sure how we're going to protect against that. Currently, we explicitly prevent recursion altogether to get around loops, but in this case, we need to recurse to get the right result.

Flags: needinfo?(jteh)

This test case would result in infinite recursion if we didn't protect against that:
data:text/html,<button id="button"><span aria-labelledby="label"></span></button><div id="label">foo<span aria-labelledby="button"></span></div>

You need to log in before you can comment on or make changes to this bug.