Title: [184890] trunk
- Revision
- 184890
- Author
- [email protected]
- Date
- 2015-05-26 17:53:00 -0700 (Tue, 26 May 2015)
Log Message
AX: display:none content exposed to accessibility when aria-hidden is toggled on ancestor element
https://bugs.webkit.org/show_bug.cgi?id=139142
Reviewed by Darin Adler.
Source/WebCore:
Amend the code that determines when an invisible, but aria-hidden=false, element is exposed to accessibility.
The new guideline is that you must have aria-hidden=false on every node that is not rendered (except text which inherits)
otherwise the element will not be visible.
Modified existing test: accessibility/aria-hidden-false-works-in-subtrees.html
* accessibility/AXObjectCache.cpp:
(WebCore::isNodeAriaVisible):
(WebCore::AXObjectCache::rootWebArea):
LayoutTests:
* accessibility/aria-hidden-false-works-in-subtrees.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (184889 => 184890)
--- trunk/LayoutTests/ChangeLog 2015-05-27 00:18:58 UTC (rev 184889)
+++ trunk/LayoutTests/ChangeLog 2015-05-27 00:53:00 UTC (rev 184890)
@@ -1,3 +1,12 @@
+2015-05-26 Chris Fleizach <[email protected]>
+
+ AX: display:none content exposed to accessibility when aria-hidden is toggled on ancestor element
+ https://bugs.webkit.org/show_bug.cgi?id=139142
+
+ Reviewed by Darin Adler.
+
+ * accessibility/aria-hidden-false-works-in-subtrees.html:
+
2015-05-26 Zalan Bujtas <[email protected]>
Overhanging float sets are not cleaned up properly when floating renderer is destroyed.
Modified: trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html (184889 => 184890)
--- trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html 2015-05-27 00:18:58 UTC (rev 184889)
+++ trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html 2015-05-27 00:53:00 UTC (rev 184890)
@@ -5,20 +5,59 @@
</head>
<body id="body">
+<div id="content">
+
<div hidden aria-hidden="false" aria-label="group0">
<div aria-hidden="true" aria-label="group1">
ignore me
</div>
- <div role="group" aria-label="group2">
- <div role="button" aria-label="button1">button</div>
+ <div aria-hidden="false" role="group" aria-label="group2">
+ <div aria-hidden="false" role="button" aria-label="button1">button</div>
don't ignore me
</div>
</div>
+<!-- The text node should be visible because it inherits from the parent -->
+<div id="group3" hidden aria-hidden="false">
+text3
+</div>
+
+<!-- The text node should be visible because it inherits from the parent, and all parents need aria-hidden=false -->
+<div id="group4" hidden aria-hidden="false">
+ <div role="group" hidden aria-hidden="false">
+ text4
+ </div>
+</div>
+
+<!-- The text node should NOT be visible because it inherits from the parent, and all parents need aria-hidden=false -->
+<div id="group5" role="group">
+ <div hidden>
+ <div role="group" hidden aria-hidden="false">
+ text5
+ </div>
+ </div>
+</div>
+
+<!-- The button inside should NOT be visible because it is not marked as aria-hidden -->
+<div id="group6" hidden aria-hidden="false">
+ <div aria-hidden="false">
+ <button>button</button>
+ </div>
+</div>
+
+<!-- The button inside should be visible because it is marked as aria-hidden and all its parents are too -->
+<div id="group7" hidden aria-hidden="false">
+ <div aria-hidden="false">
+ <button aria-hidden="false">button</button>
+ </div>
+</div>
+
<div id="iframe">
<iframe _onload_="testiFrameContent();" aria-hidden="false" src="" content</iframe>
</div>
+</div>
+
<p id="description"></p>
<div id="console"></div>
@@ -34,6 +73,8 @@
iframeChild = iframe.childAtIndex(0);
debug("iFrame child role: " + iframeChild.role);
+ document.getElementById("content").style.visibility = "hidden";
+
finishJSTest();
}
@@ -53,10 +94,37 @@
if (window.accessibilityController) {
window.jsTestIsAsync = true;
- var root = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
+ var root = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
dumpAccessibilityChildren(root, 0);
-}
+ // Text inside aria-hidden=false inherits from parent.
+ var object = accessibilityController.accessibleElementById("group3").childAtIndex(0);
+ shouldBe("object.role", "'AXRole: AXStaticText'");
+ var stringValue = object.stringValue.replace(/\n/g, '');
+ shouldBe("stringValue", "'AXValue: text3'");
+
+ // Text inside nested aria-hidden=false inherits from parent.
+ object = accessibilityController.accessibleElementById("group4").childAtIndex(0).childAtIndex(0);
+ shouldBe("object.role", "'AXRole: AXStaticText'");
+ stringValue = object.stringValue.replace(/\n/g, '');
+ shouldBe("stringValue", "'AXValue: text4 '");
+
+ // When not all the parents have aria-hidden=false, element should not be visible.
+ object = accessibilityController.accessibleElementById("group5").childAtIndex(0);
+ shouldBeTrue("!object || !object.isValid");
+
+ // Objects that don't have aria-hidden=false are not visible when the parents have that attribute.
+ object = accessibilityController.accessibleElementById("group6").childAtIndex(0);
+ shouldBe("object.role", "'AXRole: AXGroup'");
+ shouldBe("object.childrenCount", "0");
+
+ // When all objects have aria-hidden=false, then the elements are visible.
+ object = accessibilityController.accessibleElementById("group7").childAtIndex(0);
+ shouldBe("object.role", "'AXRole: AXGroup'");
+ shouldBe("object.childrenCount", "1");
+ shouldBe("object.childAtIndex(0).role", "'AXRole: AXButton'");
+ }
+
</script>
<script src=""
Modified: trunk/Source/WebCore/ChangeLog (184889 => 184890)
--- trunk/Source/WebCore/ChangeLog 2015-05-27 00:18:58 UTC (rev 184889)
+++ trunk/Source/WebCore/ChangeLog 2015-05-27 00:53:00 UTC (rev 184890)
@@ -1,3 +1,21 @@
+2015-05-26 Chris Fleizach <[email protected]>
+
+ AX: display:none content exposed to accessibility when aria-hidden is toggled on ancestor element
+ https://bugs.webkit.org/show_bug.cgi?id=139142
+
+ Reviewed by Darin Adler.
+
+ Amend the code that determines when an invisible, but aria-hidden=false, element is exposed to accessibility.
+
+ The new guideline is that you must have aria-hidden=false on every node that is not rendered (except text which inherits)
+ otherwise the element will not be visible.
+
+ Modified existing test: accessibility/aria-hidden-false-works-in-subtrees.html
+
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::isNodeAriaVisible):
+ (WebCore::AXObjectCache::rootWebArea):
+
2015-05-26 Roger Fong <[email protected]>
Enable element unsigned index in WebGL2 again.
Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (184889 => 184890)
--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2015-05-27 00:18:58 UTC (rev 184889)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2015-05-27 00:53:00 UTC (rev 184890)
@@ -1300,20 +1300,30 @@
{
if (!node)
return false;
-
- // To determine if a node is ARIA visible, we need to check the parent hierarchy to see if anyone specifies
- // aria-hidden explicitly.
+
+ // ARIA Node visibility is controlled by aria-hidden
+ // 1) if aria-hidden=true, the whole subtree is hidden
+ // 2) if aria-hidden=false, and the object is rendered, there's no effect
+ // 3) if aria-hidden=false, and the object is NOT rendered, then it must have
+ // aria-hidden=false on each parent until it gets to a rendered object
+ // 3b) a text node inherits a parents aria-hidden value
+ bool requiresAriaHiddenFalse = !node->renderer();
+ bool ariaHiddenFalsePresent = false;
for (Node* testNode = node; testNode; testNode = testNode->parentNode()) {
if (is<Element>(*testNode)) {
const AtomicString& ariaHiddenValue = downcast<Element>(*testNode).fastGetAttribute(aria_hiddenAttr);
- if (equalIgnoringCase(ariaHiddenValue, "false"))
- return true;
if (equalIgnoringCase(ariaHiddenValue, "true"))
return false;
+
+ bool ariaHiddenFalse = equalIgnoringCase(ariaHiddenValue, "false");
+ if (!testNode->renderer() && !ariaHiddenFalse)
+ return false;
+ if (!ariaHiddenFalsePresent && ariaHiddenFalse)
+ ariaHiddenFalsePresent = true;
}
}
- return false;
+ return !requiresAriaHiddenFalse || ariaHiddenFalsePresent;
}
AccessibilityObject* AXObjectCache::rootWebArea()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes