Commit d04265ef authored by Matt Giuca's avatar Matt Giuca Committed by Commit Bot

ChromeVox: If text field changes, only speak if it's focused.

Partially reverts r483795.

The previous behaviour created a bad condition where the Omnibox OnBlur
event needs to deselect the text inside but the deselection erroneously
fires an utterance (even though the text field is deselected).

      interactive_ui_tests --gtest_filter='*SpokenFeedbackTest.*'

Bug: 740430
Test: revert c603f3c7, then run
Change-Id: I9fc8fba2bc0ac29567d26cde5ba49a550a741fa9
Reviewed-on: https://chromium-review.googlesource.com/564869Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: Matt Giuca <mgiuca@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487350}
parent 3eff2f26
...@@ -394,15 +394,15 @@ DesktopAutomationHandler.prototype = { ...@@ -394,15 +394,15 @@ DesktopAutomationHandler.prototype = {
* @private * @private
*/ */
onEditableChanged_: function(evt) { onEditableChanged_: function(evt) {
if (!this.createTextEditHandlerIfNeeded_(evt.target))
return;
if (!ChromeVoxState.instance.currentRange) { if (!ChromeVoxState.instance.currentRange) {
this.onEventDefault(evt); this.onEventDefault(evt);
ChromeVoxState.instance.setCurrentRange( ChromeVoxState.instance.setCurrentRange(
cursors.Range.fromNode(evt.target)); cursors.Range.fromNode(evt.target));
} }
if (!this.createTextEditHandlerIfNeeded_(evt.target))
return;
// Sync the ChromeVox range to the editable, if a selection exists. // Sync the ChromeVox range to the editable, if a selection exists.
var anchorObject = evt.target.root.anchorObject; var anchorObject = evt.target.root.anchorObject;
var anchorOffset = evt.target.root.anchorOffset || 0; var anchorOffset = evt.target.root.anchorOffset || 0;
...@@ -527,7 +527,8 @@ DesktopAutomationHandler.prototype = { ...@@ -527,7 +527,8 @@ DesktopAutomationHandler.prototype = {
return false; return false;
var topRoot = AutomationUtil.getTopLevelRoot(node); var topRoot = AutomationUtil.getTopLevelRoot(node);
if (topRoot && topRoot.parent && !topRoot.parent.state.focused) if (!node.state.focused ||
(topRoot && topRoot.parent && !topRoot.parent.state.focused))
return false; return false;
// Re-target the node to the root of the editable. // Re-target the node to the root of the editable.
......
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