Closed Bug 1566324 Opened 6 years ago Closed 6 years ago

aria-activedescendant broken inside shadow DOM

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

References

Details

(Keywords: parity-chrome, Whiteboard: [skyline])

Attachments

(2 files)

STR (with the NVDA screen reader):

  1. Open this test case:
    data:text/html,<button>outside</button><div id="host"></div><script>shadow = host.attachShadow({mode: "open"}); shadow.innerHTML = '<div role="listbox" id="list" tabindex="0" aria-activedescendant="item"><div role="option" id="item">item</div>></div>';</script>
  2. Tab to the button.
  3. Press tab again.
    • Expected: NVDA should say "list, item..."
    • Actual: NVDA says just "list"

This bug means that the accessibility implemented for the password list in about:logins in bug 1560359 doesn't work.

Works in Chrome.

Unfortunately, fixing this properly will probably break the address bar, since I believe it uses aria-activedescendant to refer to an autocomplete result which is outside the address bar's binding. That might be fixed by bug 1513337. In the interim, I'm not quite sure how to proceed here.

Keywords: parity-chrome

(In reply to James Teh [:Jamie] from comment #0)

Unfortunately, fixing this properly will probably break the address bar, since I believe it uses aria-activedescendant to refer to an autocomplete result which is outside the address bar's binding. That might be fixed by bug 1513337.

Bug 1513337 is now fixed, so now, the active descendants are in the same scope. Thus, a proper implementation is now possible here.

Depends on: 1513337
Assignee: nobody → jteh

Expanded STR that tests changing the active descendant as well:

STR (with the NVDA screen reader):

  1. Open this test case:
    data:text/html,<button>outside</button><div id="host"></div><script>shadow = host.attachShadow({mode: "open"}); shadow.innerHTML = '<div role="listbox" id="list" tabindex="0" aria-activedescendant="item1"><div role="option" id="item1">item1</div><div role="option" id="item2">item2</div></div>'; shadow.getElementById("list").addEventListener("keydown", function(event) { if (event.key == "ArrowDown") event.target.setAttribute("aria-activedescendant", "item2"); });</script>
  2. Tab to the button.
  3. Press tab again.
    • Expected: NVDA should say "list, item1..."
    • Actual: NVDA says just "list"
  4. Press down arrow.
    • Expected: NVDA should say "item2..."
    • Actual: NVDA says nothing.

IDRefsIterator::GetElem was previously an instance method which could only be used if you instantiated IDRefsIterator.
This is overkill for attributes which can only take a single id reference (rather than an id reference list).
Now, there is a static version of IDRefsIterator::GetElem which can be called with an arbitrary source element.
Any accessibility code should henceforth be using this instead of calling GetElementById directly, as this deals with shadow DOM, etc.

Previously, the target element for aria-activedescendant was retrieved by calling GetElementById on the owner document.
This meant that aria-activedescendant inside shadow DOM looked for ids in the owner document instead of the shadow DOM.
To fix this, use IDRefsIterator::GetElem instead.

Status: NEW → ASSIGNED
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/381183f36e38 part 1: Make a static version of IDRefsIterator::GetElem which can be called to get an id reference for any element. r=eeejay https://hg.mozilla.org/integration/autoland/rev/9c49cf0958b9 part 2: Respect shadow DOM for aria-activedescendant. r=eeejay
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
Whiteboard: [skyline]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: