Commit 0d185a4f authored by aleventhal's avatar aleventhal Committed by Commit bot

Compute accessible name of objects with ARIA role of 'row' if they can receive focus

BUG=710024

Review-Url: https://codereview.chromium.org/2805343002
Cr-Commit-Position: refs/heads/master@{#463365}
parent b9af474c
<!DOCTYPE HTML>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<body id="body">
<div role="treegrid">
<div role="row" id="treegrid1-row1" tabindex="-1">
<div role="rowheader">row head</div>
<div role="gridcell">data</div>
</div>
</div>
<div role="treegrid" aria-activedescendant="treegrid2-row1">
<div role="row" id="treegrid2-row1">
<div role="rowheader">row head</div>
<div role="gridcell">data</div>
</div>
</div>
<div role="grid">
<div role="row" id="treegrid3-row1">
<div role="rowheader">row head</div>
<div role="gridcell">data</div>
</div>
</div>
</body>
<script>
function axElementById(id) {
return accessibilityController.accessibleElementById(id);
}
test(function(t) {
var axRow = axElementById("treegrid1-row1");
assert_equals(axRow.name, 'row head data');
}, "The row's name must concatenate the children if the row is focusable");
test(function(t) {
var axRow = axElementById("treegrid2-row1");
assert_equals(axRow.name, 'row head data');
}, "The row's name must concatenate the children if the parent has aria-activedescendant");
test(function(t) {
var axRow = axElementById("treegrid3-row1");
assert_equals(axRow.name, '');
}, "The row's name must empty when the parent is not focusable and there is no other labelling markup (for performance reasons)");
</script>
......@@ -1769,6 +1769,16 @@ bool AXObject::NameFromContents() const {
case kTreeItemRole:
case kUserInterfaceTooltipRole:
return true;
case kRowRole: {
// Spec says we should always expose the name on rows,
// but for performance reasons we only do it
// if the row might receive focus
if (AncestorExposesActiveDescendant()) {
return true;
}
const Node* node = this->GetNode();
return node && node->IsElementNode() && ToElement(node)->IsFocusable();
}
default:
return false;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment