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

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

Issue 1589623002: Keep track of accessibility focus across windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final suggestions Created 4 years, 10 months 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
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 16e8cbb568075711048a0339d40f36eab7b34a01..9d3053cffec321ef08dd78c17ba801020f14adea 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
@@ -208,6 +208,22 @@ Background.prototype = {
(new PanelCommand(PanelCommandType.DISABLE_MENUS)).send();
}
+ // If switching to Classic from any automation-API-based mode,
+ // clear the focus ring.
+ if (mode === ChromeVoxMode.CLASSIC && mode != this.mode_) {
+ if (cvox.ChromeVox.isChromeOS)
+ chrome.accessibilityPrivate.setFocusRing([]);
+ }
+
+ // If switching away from Classic to any automation-API-based mode,
+ // update the range based on what's focused.
+ if (this.mode_ === ChromeVoxMode.CLASSIC && mode != this.mode_) {
+ chrome.automation.getFocus((function(focus) {
+ if (focus)
+ this.setCurrentRange(cursors.Range.fromNode(focus));
+ }).bind(this));
+ }
+
this.mode_ = mode;
},
@@ -499,6 +515,11 @@ Background.prototype = {
// Leaving unlocalized as 'next' isn't an official name.
cvox.ChromeVox.tts.speak(isClassic ?
'classic' : 'next', cvox.QueueMode.FLUSH, {doNotInterrupt: true});
+
+ // If the new mode is Classic, return now so we don't announce
+ // anything more.
+ if (newMode == ChromeVoxMode.CLASSIC)
+ return false;
break;
case 'toggleStickyMode':
cvox.ChromeVoxBackground.setPref('sticky',

Powered by Google App Engine
This is Rietveld 408576698