Skip to content

Commit

Permalink
Merge r222544 - AX: Several ARIA roles with presentational children a…
Browse files Browse the repository at this point in the history
…re exposing children

https://bugs.webkit.org/show_bug.cgi?id=177502

Reviewed by Chris Fleizach.

Source/WebCore:

Add MenuItemCheckboxRole, MenuItemRadioRole, and SplitterRole to the list
of AccessibilityRole types which cannot have children. In the case of
DocumentMathRole, only treat children as presentational (excluded from the
accessibility tree) if the element is not MathML.

Test: accessibility/presentational-children.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::canHaveChildren const):

LayoutTests:

New test. Also update the results for the inspector because ARIA separators
and their subclass roles should not expose (claim to have) children.

* accessibility/presentational-children-expected.txt: Added.
* accessibility/presentational-children.html: Added.
* inspector/dom/getAccessibilityPropertiesForNode-expected.txt: Updated.
  • Loading branch information
joanmarie authored and carlosgcampos committed Oct 17, 2017
1 parent b82882b commit afb7640
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 1 deletion.
14 changes: 14 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
2017-09-26 Joanmarie Diggs <jdiggs@igalia.com>

AX: Several ARIA roles with presentational children are exposing children
https://bugs.webkit.org/show_bug.cgi?id=177502

Reviewed by Chris Fleizach.

New test. Also update the results for the inspector because ARIA separators
and their subclass roles should not expose (claim to have) children.

* accessibility/presentational-children-expected.txt: Added.
* accessibility/presentational-children.html: Added.
* inspector/dom/getAccessibilityPropertiesForNode-expected.txt: Updated.

2017-09-26 Zalan Bujtas <zalan@apple.com>

Fall back to normal line layout position, when simple line layout fails to find one.
Expand Down
23 changes: 23 additions & 0 deletions LayoutTests/accessibility/presentational-children-expected.txt
@@ -0,0 +1,23 @@
This tests that roles with children presentational true report no children.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


button childrenCount: 0
checkbox childrenCount: 0
img childrenCount: 0
math childrenCount: 0
menuitemcheckbox childrenCount: 0
menuitemradio childrenCount: 0
option childrenCount: 0
progressbar childrenCount: 0
radio childrenCount: 0
scrollbar childrenCount: 0
separator childrenCount: 0
slider childrenCount: 0
switch childrenCount: 0
tab childrenCount: 0
PASS successfullyParsed is true

TEST COMPLETE

46 changes: 46 additions & 0 deletions LayoutTests/accessibility/presentational-children.html
@@ -0,0 +1,46 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body id="body">
<div id="content">
<div role="button" tabindex="0" class="ex"><div>a</div><div>b</div></div>
<div role="checkbox" tabindex="0" class="ex"><div>a</div><div>b</div></div>
<div role="img" tabindex="0" class="ex"><div>a</div><div>b</div></div>
<div role="math" tabindex="0" class="ex"><div>a</div><div>b</div></div>
<div role="menu">
<div role="menuitemcheckbox" tabindex="0" class="ex"><div>a</div><div>b</div></div>
<div role="menuitemradio" tabindex="0" class="ex"><div>a</div><div>b</div></div>
</div>
<div role="listbox">
<div role="option" tabindex="0" class="ex"><div>a</div><div>b</div></div>
</div>
<div role="progressbar" tabindex="0" class="ex"><div>a</div><div>b</div></div>
<div role="radio" tabindex="0" class="ex"><div>a</div><div>b</div></div>
<div role="scrollbar" tabindex="0" class="ex"><div>a</div><div>b</div></div>
<div role="separator" tabindex="0" class="ex"><div>a</div><div>b</div></div>
<div role="slider" tabindex="0" class="ex"><div>a</div><div>b</div></div>
<div role="switch" tabindex="0" class="ex"><div>a</div><div>b</div></div>
<div role="tablist">
<div role="tab" tabindex="0" class="ex"><div>a</div><div>b</div></div>
</div>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that roles with children presentational true report no children.");
if (window.accessibilityController) {
var elements = document.querySelectorAll(".ex");
var count = elements.length;
for (var i = 0; i < count; i++) {
var el = elements[i];
el.focus();
debug(el.getAttribute("role") + " childrenCount: " + accessibilityController.focusedElement.childrenCount);
}
document.getElementById("content").style.visibility = "hidden";
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>
Expand Up @@ -484,7 +484,6 @@ Total elements to be tested: 122.
exists: true
label:
role: separator
childNodeIds.length: 1
parentNodeId: exists

<div role="doc-notice">doc-notice</div>
Expand Down
17 changes: 17 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,20 @@
2017-09-26 Joanmarie Diggs <jdiggs@igalia.com>

AX: Several ARIA roles with presentational children are exposing children
https://bugs.webkit.org/show_bug.cgi?id=177502

Reviewed by Chris Fleizach.

Add MenuItemCheckboxRole, MenuItemRadioRole, and SplitterRole to the list
of AccessibilityRole types which cannot have children. In the case of
DocumentMathRole, only treat children as presentational (excluded from the
accessibility tree) if the element is not MathML.

Test: accessibility/presentational-children.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::canHaveChildren const):

2017-09-26 Zalan Bujtas <zalan@apple.com>

Fall back to normal line layout position, when simple line layout fails to find one.
Expand Down
8 changes: 8 additions & 0 deletions Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Expand Up @@ -382,6 +382,14 @@ bool AccessibilityNodeObject::canHaveChildren() const
case ScrollBarRole:
case ProgressIndicatorRole:
case SwitchRole:
case MenuItemCheckboxRole:
case MenuItemRadioRole:
case SplitterRole:
return false;
case DocumentMathRole:
#if ENABLE(MATHML)
return node()->isMathMLElement();
#endif
return false;
default:
return true;
Expand Down

0 comments on commit afb7640

Please sign in to comment.