Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3542)

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js

Issue 2470413005: Fix reset and focus issues in OOBE (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/renderer/resources/extensions/automation_custom_bindings.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
index 617373eff1b9910ea2ef10be6f13f03780051562..0284dfe1835de1531bd1ee6912cf8229f98cacac 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
@@ -427,11 +427,10 @@ Background.prototype = {
navigateToRange: function(range, opt_focus, opt_speechProps) {
opt_focus = opt_focus === undefined ? true : opt_focus;
opt_speechProps = opt_speechProps || {};
-
+ var prevRange = this.currentRange_;
if (opt_focus)
- this.setFocusToRange_(range);
+ this.setFocusToRange_(range, prevRange);
- var prevRange = this.currentRange_;
this.setCurrentRange(range);
var o = new Output();
@@ -760,9 +759,10 @@ Background.prototype = {
/**
* @param {!cursors.Range} range
+ * @param {cursors.Range} prevRange
* @private
*/
- setFocusToRange_: function(range) {
+ setFocusToRange_: function(range, prevRange) {
var start = range.start.node;
var end = range.end.node;
if (start.state.focused || end.state.focused)
@@ -773,7 +773,18 @@ Background.prototype = {
AutomationPredicate.linkOrControl(node);
};
- // First, try to focus the start or end node.
+ // First, see if we've crossed a root. Remove once webview handles focus
+ // correctly.
+ if (prevRange && prevRange.start.node) {
+ var entered = AutomationUtil.getUniqueAncestors(
+ prevRange.start.node, start);
+ var embeddedObject = entered.find(function(f) {
+ return f.role == RoleType.embeddedObject; });
+ if (embeddedObject)
+ embeddedObject.focus();
+ }
+
+ // Next, try to focus the start or end node.
if (isFocusableLinkOrControl(start)) {
if (!start.state.focused)
start.focus();
« no previous file with comments | « no previous file | chrome/renderer/resources/extensions/automation_custom_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698