Commit 9608522d authored by David Tseng's avatar David Tseng Committed by Commit Bot

Proactively clear ChromeVox focus ring

Change-Id: I5712c277c3a52b824e35ebc990e78e2131b18a73
Reviewed-on: https://chromium-review.googlesource.com/1217031Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: David Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590412}
parent 75f908e6
...@@ -178,30 +178,35 @@ Background.prototype = { ...@@ -178,30 +178,35 @@ Background.prototype = {
// the user navigates. // the user navigates.
cvox.ChromeVox.braille.thaw(); cvox.ChromeVox.braille.thaw();
if (newRange && !newRange.isValid()) if (newRange && !newRange.isValid()) {
chrome.accessibilityPrivate.setFocusRing([]);
return; return;
}
this.currentRange_ = newRange; this.currentRange_ = newRange;
ChromeVoxState.observers.forEach(function(observer) { ChromeVoxState.observers.forEach(function(observer) {
observer.onCurrentRangeChanged(newRange); observer.onCurrentRangeChanged(newRange);
}); });
if (this.currentRange_) { if (!this.currentRange_) {
var start = this.currentRange_.start.node; chrome.accessibilityPrivate.setFocusRing([]);
start.makeVisible(); return;
}
var root = AutomationUtil.getTopLevelRoot(start); var start = this.currentRange_.start.node;
if (!root || root.role == RoleType.DESKTOP || root == start) start.makeVisible();
return;
var position = {}; var root = AutomationUtil.getTopLevelRoot(start);
var loc = start.unclippedLocation; if (!root || root.role == RoleType.DESKTOP || root == start)
position.x = loc.left + loc.width / 2; return;
position.y = loc.top + loc.height / 2;
var url = root.docUrl; var position = {};
url = url.substring(0, url.indexOf('#')) || url; var loc = start.unclippedLocation;
cvox.ChromeVox.position[url] = position; position.x = loc.left + loc.width / 2;
} position.y = loc.top + loc.height / 2;
var url = root.docUrl;
url = url.substring(0, url.indexOf('#')) || url;
cvox.ChromeVox.position[url] = position;
}, },
/** /**
......
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