Commit 0b6e8773 authored by David Tseng's avatar David Tseng Committed by Commit Bot

Compute text content for list items without names

Chrome doesn't compute descendant name on focus in this case.

Bug: 795275
Test: manually on twitter.com using j/k. Verify all text gets read.
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I3bf48846aac498655cae8488331df09b65ff9b53
Reviewed-on: https://chromium-review.googlesource.com/881884
Commit-Queue: David Tseng <dtseng@chromium.org>
Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532690}
parent b18dd354
...@@ -293,7 +293,7 @@ Output.RULES = { ...@@ -293,7 +293,7 @@ Output.RULES = {
// author (via posInSet), do we include them in the output. // author (via posInSet), do we include them in the output.
enter: `$nameFromNode $role $state $restriction $description enter: `$nameFromNode $role $state $restriction $description
$if($posInSet, @describe_index($posInSet, $setSize))`, $if($posInSet, @describe_index($posInSet, $setSize))`,
speak: `$state $name= $role speak: `$state $nameOrTextContent= $role
$if($posInSet, @describe_index($posInSet, $setSize)) $if($posInSet, @describe_index($posInSet, $setSize))
$description $restriction` $description $restriction`
}, },
...@@ -1216,22 +1216,21 @@ Output.prototype = { ...@@ -1216,22 +1216,21 @@ Output.prototype = {
var related = node[tree.firstChild.value]; var related = node[tree.firstChild.value];
this.node_(related, related, Output.EventType.NAVIGATE, buff); this.node_(related, related, Output.EventType.NAVIGATE, buff);
} else if (token == 'nameOrTextContent') { } else if (token == 'nameOrTextContent') {
var finalOutput;
if (node.name) { if (node.name) {
finalOutput = node.name; this.format_(node, '$name', buff);
} else { return;
var walker = new AutomationTreeWalker(node, Dir.FORWARD, { }
visit: AutomationPredicate.leafOrStaticText, var walker = new AutomationTreeWalker(node, Dir.FORWARD, {
leaf: AutomationPredicate.leafOrStaticText visit: AutomationPredicate.leafOrStaticText,
}); leaf: AutomationPredicate.leafOrStaticText
var outputStrings = []; });
while (walker.next().node && var outputStrings = [];
walker.phase == AutomationTreeWalkerPhase.DESCENDANT) { while (walker.next().node &&
if (walker.node.name) walker.phase == AutomationTreeWalkerPhase.DESCENDANT) {
outputStrings.push(walker.node.name); if (walker.node.name)
} outputStrings.push(walker.node.name);
finalOutput = outputStrings.join(' ');
} }
var finalOutput = outputStrings.join(' ');
this.append_(buff, finalOutput, options); this.append_(buff, finalOutput, options);
} else if (node[token] !== undefined) { } else if (node[token] !== undefined) {
options.annotation.push(token); options.annotation.push(token);
......
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