Skip to content

Commit

Permalink
Always ignore context (ancestry) output for window nodes
Browse files Browse the repository at this point in the history
In views, a window sometimes gets repeated twice e.g. Google window
Google window.

This is because a window with name Google has a parent that is also a
window with name Google.

The first gets picked up as a result of the speak rule. The second as
a result of the enter (context) rule.

Suppress this specific case by never allowing context when the
output's target is a window.

Bug: None
Test: alt-tab between windows where a window gets focused. Verify no double speak.
Change-Id: I3e4d5fb9d641c065ee87aa9b0085e8048f31cf5b
Reviewed-on: https://chromium-review.googlesource.com/668095
Commit-Queue: David Tseng <dtseng@chromium.org>
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#502384}
  • Loading branch information
dtsengchromium authored and Commit Bot committed Sep 15, 2017
1 parent 7335237 commit 7c26f56
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,13 @@ Output.SPACE = ' ';
* @const {Object<{msgId: string,
* earconId: (string|undefined),
* inherits: (string|undefined),
* outputContextFirst: (boolean|undefined)}>}
* outputContextFirst: (boolean|undefined),
* ignoreAncestry: (boolean|undefined)}>}
* msgId: the message id of the role.
* earconId: an optional earcon to play when encountering the role.
* inherits: inherits rules from this role.
* outputContextFirst: where to place the context output.
* ignoreAncestry: ignores ancestry (context) output for this role.
* @private
*/
Output.ROLE_INFO_ = {
Expand All @@ -132,7 +134,8 @@ Output.ROLE_INFO_ = {
contentInfo: {msgId: 'role_contentinfo', inherits: 'abstractContainer'},
date: {msgId: 'input_type_date', inherits: 'abstractContainer'},
definition: {msgId: 'role_definition', inherits: 'abstractContainer'},
dialog: {msgId: 'role_dialog', outputContextFirst: true},
dialog:
{msgId: 'role_dialog', outputContextFirst: true, ignoreAncestry: true},
directory: {msgId: 'role_directory', inherits: 'abstractContainer'},
document: {msgId: 'role_document', inherits: 'abstractContainer'},
form: {msgId: 'role_form', inherits: 'abstractContainer'},
Expand All @@ -157,7 +160,7 @@ Output.ROLE_INFO_ = {
msgId: 'role_marquee',
},
math: {msgId: 'role_math', inherits: 'abstractContainer'},
menu: {msgId: 'role_menu', outputContextFirst: true},
menu: {msgId: 'role_menu', outputContextFirst: true, ignoreAncestry: true},
menuBar: {
msgId: 'role_menubar',
},
Expand Down Expand Up @@ -196,10 +199,11 @@ Output.ROLE_INFO_ = {
textField: {msgId: 'input_type_text', earconId: 'EDITABLE_TEXT'},
time: {msgId: 'tag_time', inherits: 'abstractContainer'},
timer: {msgId: 'role_timer'},
toolbar: {msgId: 'role_toolbar'},
toolbar: {msgId: 'role_toolbar', ignoreAncestry: true},
toggleButton: {msgId: 'role_button', inherits: 'checkBox'},
tree: {msgId: 'role_tree'},
treeItem: {msgId: 'role_treeitem'}
treeItem: {msgId: 'role_treeitem'},
window: {ignoreAncestry: true}
};

/**
Expand Down Expand Up @@ -1411,6 +1415,11 @@ Output.prototype = {
* @private
*/
ancestry_: function(node, prevNode, type, buff) {
if (Output.ROLE_INFO_[node.role] &&
Output.ROLE_INFO_[node.role].ignoreAncestry) {
return;
}

// Expects |ancestors| to be ordered from root down to leaf. Outputs in
// reverse; place context first nodes at the end.
function byContextFirst(ancestors) {
Expand Down

0 comments on commit 7c26f56

Please sign in to comment.