Changeset 184890 in webkit
- Timestamp:
- May 26, 2015, 5:53:00 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r184885 r184890 1 2015-05-26 Chris Fleizach <cfleizach@apple.com> 2 3 AX: display:none content exposed to accessibility when aria-hidden is toggled on ancestor element 4 https://bugs.webkit.org/show_bug.cgi?id=139142 5 6 Reviewed by Darin Adler. 7 8 * accessibility/aria-hidden-false-works-in-subtrees.html: 9 1 10 2015-05-26 Zalan Bujtas <zalan@apple.com> 2 11 -
trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html
r160789 r184890 6 6 <body id="body"> 7 7 8 <div id="content"> 9 8 10 <div hidden aria-hidden="false" aria-label="group0"> 9 11 <div aria-hidden="true" aria-label="group1"> 10 12 ignore me 11 13 </div> 12 <div role="group" aria-label="group2">13 <div role="button" aria-label="button1">button</div>14 <div aria-hidden="false" role="group" aria-label="group2"> 15 <div aria-hidden="false" role="button" aria-label="button1">button</div> 14 16 don't ignore me 17 </div> 18 </div> 19 20 <!-- The text node should be visible because it inherits from the parent --> 21 <div id="group3" hidden aria-hidden="false"> 22 text3 23 </div> 24 25 <!-- The text node should be visible because it inherits from the parent, and all parents need aria-hidden=false --> 26 <div id="group4" hidden aria-hidden="false"> 27 <div role="group" hidden aria-hidden="false"> 28 text4 29 </div> 30 </div> 31 32 <!-- The text node should NOT be visible because it inherits from the parent, and all parents need aria-hidden=false --> 33 <div id="group5" role="group"> 34 <div hidden> 35 <div role="group" hidden aria-hidden="false"> 36 text5 37 </div> 38 </div> 39 </div> 40 41 <!-- The button inside should NOT be visible because it is not marked as aria-hidden --> 42 <div id="group6" hidden aria-hidden="false"> 43 <div aria-hidden="false"> 44 <button>button</button> 45 </div> 46 </div> 47 48 <!-- The button inside should be visible because it is marked as aria-hidden and all its parents are too --> 49 <div id="group7" hidden aria-hidden="false"> 50 <div aria-hidden="false"> 51 <button aria-hidden="false">button</button> 15 52 </div> 16 53 </div> … … 18 55 <div id="iframe"> 19 56 <iframe onload="testiFrameContent();" aria-hidden="false" src="resources/cake.png">hidden content</iframe> 57 </div> 58 20 59 </div> 21 60 … … 34 73 iframeChild = iframe.childAtIndex(0); 35 74 debug("iFrame child role: " + iframeChild.role); 75 76 document.getElementById("content").style.visibility = "hidden"; 36 77 37 78 finishJSTest(); … … 54 95 window.jsTestIsAsync = true; 55 96 56 var root = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0); 97 var root = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0); 57 98 dumpAccessibilityChildren(root, 0); 58 } 99 100 // Text inside aria-hidden=false inherits from parent. 101 var object = accessibilityController.accessibleElementById("group3").childAtIndex(0); 102 shouldBe("object.role", "'AXRole: AXStaticText'"); 103 var stringValue = object.stringValue.replace(/\n/g, ''); 104 shouldBe("stringValue", "'AXValue: text3'"); 105 106 // Text inside nested aria-hidden=false inherits from parent. 107 object = accessibilityController.accessibleElementById("group4").childAtIndex(0).childAtIndex(0); 108 shouldBe("object.role", "'AXRole: AXStaticText'"); 109 stringValue = object.stringValue.replace(/\n/g, ''); 110 shouldBe("stringValue", "'AXValue: text4 '"); 111 112 // When not all the parents have aria-hidden=false, element should not be visible. 113 object = accessibilityController.accessibleElementById("group5").childAtIndex(0); 114 shouldBeTrue("!object || !object.isValid"); 115 116 // Objects that don't have aria-hidden=false are not visible when the parents have that attribute. 117 object = accessibilityController.accessibleElementById("group6").childAtIndex(0); 118 shouldBe("object.role", "'AXRole: AXGroup'"); 119 shouldBe("object.childrenCount", "0"); 120 121 // When all objects have aria-hidden=false, then the elements are visible. 122 object = accessibilityController.accessibleElementById("group7").childAtIndex(0); 123 shouldBe("object.role", "'AXRole: AXGroup'"); 124 shouldBe("object.childrenCount", "1"); 125 shouldBe("object.childAtIndex(0).role", "'AXRole: AXButton'"); 126 } 59 127 60 128 </script> -
trunk/Source/WebCore/ChangeLog
r184889 r184890 1 2015-05-26 Chris Fleizach <cfleizach@apple.com> 2 3 AX: display:none content exposed to accessibility when aria-hidden is toggled on ancestor element 4 https://bugs.webkit.org/show_bug.cgi?id=139142 5 6 Reviewed by Darin Adler. 7 8 Amend the code that determines when an invisible, but aria-hidden=false, element is exposed to accessibility. 9 10 The new guideline is that you must have aria-hidden=false on every node that is not rendered (except text which inherits) 11 otherwise the element will not be visible. 12 13 Modified existing test: accessibility/aria-hidden-false-works-in-subtrees.html 14 15 * accessibility/AXObjectCache.cpp: 16 (WebCore::isNodeAriaVisible): 17 (WebCore::AXObjectCache::rootWebArea): 18 1 19 2015-05-26 Roger Fong <roger_fong@apple.com> 2 20 -
trunk/Source/WebCore/accessibility/AXObjectCache.cpp
r183783 r184890 1301 1301 if (!node) 1302 1302 return false; 1303 1304 // To determine if a node is ARIA visible, we need to check the parent hierarchy to see if anyone specifies 1305 // aria-hidden explicitly. 1303 1304 // ARIA Node visibility is controlled by aria-hidden 1305 // 1) if aria-hidden=true, the whole subtree is hidden 1306 // 2) if aria-hidden=false, and the object is rendered, there's no effect 1307 // 3) if aria-hidden=false, and the object is NOT rendered, then it must have 1308 // aria-hidden=false on each parent until it gets to a rendered object 1309 // 3b) a text node inherits a parents aria-hidden value 1310 bool requiresAriaHiddenFalse = !node->renderer(); 1311 bool ariaHiddenFalsePresent = false; 1306 1312 for (Node* testNode = node; testNode; testNode = testNode->parentNode()) { 1307 1313 if (is<Element>(*testNode)) { 1308 1314 const AtomicString& ariaHiddenValue = downcast<Element>(*testNode).fastGetAttribute(aria_hiddenAttr); 1309 if (equalIgnoringCase(ariaHiddenValue, "false"))1310 return true;1311 1315 if (equalIgnoringCase(ariaHiddenValue, "true")) 1312 1316 return false; 1317 1318 bool ariaHiddenFalse = equalIgnoringCase(ariaHiddenValue, "false"); 1319 if (!testNode->renderer() && !ariaHiddenFalse) 1320 return false; 1321 if (!ariaHiddenFalsePresent && ariaHiddenFalse) 1322 ariaHiddenFalsePresent = true; 1313 1323 } 1314 1324 } 1315 1325 1316 return false;1326 return !requiresAriaHiddenFalse || ariaHiddenFalsePresent; 1317 1327 } 1318 1328
Note:
See TracChangeset
for help on using the changeset viewer.