Commit 00fbd0db authored by David Tseng's avatar David Tseng Committed by Commit Bot

Automatically summarize dialog contents for ChromeVox

This is a proposed output change for ChromeVox's treatment of both dialog and alert dialog roles.

When entering these types of containers, ChromeVox will output the text content of the dialog first, followed by the control with range.

R=akihiroota@chromium.org

Bug: none
AX-Relnotes: ChromeVox will now summarize the text content of a dialog when entering one.
Test: browser_tests --gtest_filter=ChromeVox*.DialogAuto*
Change-Id: Ic24f05bfb9f65e582239ed1e271ba4a78fefb034
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2378730
Commit-Queue: David Tseng <dtseng@chromium.org>
Reviewed-by: default avatarAkihiro Ota <akihiroota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806025}
parent 46cbbd2e
...@@ -3034,3 +3034,29 @@ TEST_F('ChromeVoxBackgroundTest', 'SwipeLeftRight2', function() { ...@@ -3034,3 +3034,29 @@ TEST_F('ChromeVoxBackgroundTest', 'SwipeLeftRight2', function() {
.replay(); .replay();
}); });
}); });
TEST_F('ChromeVoxBackgroundTest', 'DialogAutoSummaryTextContent', function() {
// This was overridden in setUp() for most all tests, but we want the
// production behavior here.
Output.ROLE_INFO_[RoleType.DIALOG]['outputContextFirst'] = true;
const mockFeedback = this.createMockFeedback();
this.runWithLoadedTree(
`
<p>start</p>
<div role="dialog" aria-label="Setup">
<h1>Welcome</h1>
<p>This is some introductory text<p>
<button>Exit</button>
<button>Let's go</button>
</div>
`,
function(root) {
mockFeedback.call(doCmd('nextObject'))
.expectSpeech('Setup', 'Dialog')
.expectSpeech(
`Welcome This is some introductory text Exit Let's go`)
.expectSpeech('Welcome')
.expectSpeech('Heading 1')
.replay();
});
});
...@@ -1067,8 +1067,8 @@ Output = class { ...@@ -1067,8 +1067,8 @@ Output = class {
this.node_( this.node_(
related, related, Output.EventType.NAVIGATE, buff, ruleStr); related, related, Output.EventType.NAVIGATE, buff, ruleStr);
} }
} else if (token == 'nameOrTextContent') { } else if (token == 'nameOrTextContent' || token == 'textContent') {
if (node.name) { if (node.name && token == 'nameOrTextContent') {
ruleStr.writeToken(token); ruleStr.writeToken(token);
this.format_({ this.format_({
node, node,
...@@ -2437,7 +2437,7 @@ Output.RULES = { ...@@ -2437,7 +2437,7 @@ Output.RULES = {
$state` $state`
}, },
alertDialog: { alertDialog: {
enter: `$earcon(ALERT_MODAL) $name $state $description`, enter: `$earcon(ALERT_MODAL) $name $state $description $textContent`,
speak: `$earcon(ALERT_MODAL) $name $nameOrTextContent $description $state speak: `$earcon(ALERT_MODAL) $name $nameOrTextContent $description $state
$role` $role`
}, },
...@@ -2468,7 +2468,7 @@ Output.RULES = { ...@@ -2468,7 +2468,7 @@ Output.RULES = {
$state $restriction $role $description`, $state $restriction $role $description`,
}, },
date: {enter: `$nameFromNode $role $state $restriction $description`}, date: {enter: `$nameFromNode $role $state $restriction $description`},
dialog: {enter: `$nameFromNode $role $description`}, dialog: {enter: `$nameFromNode $role $description $textContent`},
genericContainer: { genericContainer: {
enter: `$nameFromNode $description $state`, enter: `$nameFromNode $description $state`,
speak: `$nameOrTextContent $description $state` speak: `$nameOrTextContent $description $state`
......
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