Skip to content

Commit

Permalink
[AOM] Integrate element reflection with the Accessibility Tree
Browse files Browse the repository at this point in the history
This is a reland, the original review can be seen at:
https://crrev.com/c/1826397

This change now migrates the existing accessibility code to rely on the
attr-associated-elements set via the content attribute or IDL attributes.

Followup work to: https://crrev.com/c/1687013, https://crrev.com/c/1781917

Bug: 981423
Change-Id: Ie5cbf514a74e68dfee3074aa9b473dfafd3a81e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911347
Commit-Queue: Meredith Lane <meredithl@chromium.org>
Reviewed-by: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Reviewed-by: Alice Boxhall <aboxhall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#724479}
  • Loading branch information
Meredith Lane authored and chromium-wpt-export-bot committed Dec 13, 2019
1 parent 1ef9205 commit 3a5dc6a
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions dom/nodes/aria-element-reflection.tentative.html
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@

input1.removeAttribute("aria-labelledby");
assert_equals(input1.ariaLabelledByElements, null);

input1.setAttribute("aria-labelledby", "nameElement addressElement");
assert_array_equals(input1.ariaLabelledByElements, [nameElement, addressElement]);

input1.ariaLabelledByElements = null;
assert_false(input1.hasAttribute("aria-labelledby", "Nullifying the IDL attribute should remove the content attribute."));
}, "aria-labelledby.");
</script>

Expand Down Expand Up @@ -305,6 +311,12 @@

link2.removeAttribute("aria-controls");
assert_equals(link2.ariaControlsElements, null);

link2.ariaControlsElements = [panel1, panel2];
assert_equals(link2.getAttribute("aria-controls"), "panel1 panel2");

link2.ariaControlsElements = null;
assert_false(link2.hasAttribute("aria-controls", "Nullifying the IDL attribute should remove the content attribute."));
}, "aria-controls.");
</script>

Expand All @@ -327,6 +339,12 @@

describedLink.removeAttribute("aria-describedby");
assert_equals(describedLink.ariaDescribedByElements, null);

describedLink.ariaDescribedByElements = [description1, description2];
assert_equals(describedLink.getAttribute("aria-describedby"), "description1 description2");

describedLink.ariaDescribedByElements = null;
assert_false(describedLink.hasAttribute("aria-describedby", "Nullifying the IDL attribute should remove the content attribute."));
}, "aria-describedby.");
</script>

Expand All @@ -353,6 +371,12 @@ <h2 id="titleHeading" aria-flowto="article1 article2">Title</h2>

titleHeading.removeAttribute("aria-flowto");
assert_equals(titleHeading.ariaFlowToElements, null);

titleHeading.ariaFlowToElements = [article1, article2];
assert_equals(titleHeading.getAttribute("aria-flowto"), "article1 article2");

titleHeading.ariaFlowToElements = null;
assert_false(titleHeading.hasAttribute("aria-flowto", "Nullifying the IDL attribute should remove the content attribute."));
}, "aria-flowto.");
</script>

Expand All @@ -378,6 +402,12 @@ <h2 id="titleHeading" aria-flowto="article1 article2">Title</h2>

listItemOwner.setAttribute("aria-owns", "child1");
assert_array_equals(listItemOwner.ariaOwnsElements, [child1]);

listItemOwner.ariaOwnsElements = [child1, child2];
assert_equals(listItemOwner.getAttribute("aria-owns"), "child1 child2");

listItemOwner.ariaOwnsElements = null;
assert_false(listItemOwner.hasAttribute("aria-owns", "Nullifying the IDL attribute should remove the content attribute."));
}, "aria-owns.");
</script>

Expand Down Expand Up @@ -477,6 +507,7 @@ <h2 id="lightDomHeading" aria-flowto="shadowChild1 shadowChild2">Light DOM Headi
</script>

<div id="sameScopeContainer">
<div id="labeledby" aria-labeledby="headingLabel1 headingLabel2">Misspelling</div>
<div id="headingLabel1">Wonderful</div>
<div id="headingLabel2">Fantastic</div>

Expand All @@ -491,6 +522,8 @@ <h2 id="lightDomHeading" aria-flowto="shadowChild1 shadowChild2">Light DOM Headi
const headingLabel2 = document.getElementById("headingLabel2")
shadowRoot.appendChild(headingElement);

assert_array_equals(labeledby.ariaLabelledByElements, [headingLabel1, headingLabel2], "aria-labeled by is supported by IDL getter.");

// Explicitly set elements are in a lighter shadow DOM, so that's ok.
headingElement.ariaLabelledByElements = [headingLabel1, headingLabel2];
assert_array_equals(headingElement.ariaLabelledByElements, [headingLabel1, headingLabel2], "Lighter elements are gettable when explicitly set.");
Expand Down

0 comments on commit 3a5dc6a

Please sign in to comment.