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

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: git cl format Created 4 years, 11 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 bea4f4861f4d40f687adb3beedb014c5bde4c56c..07c903259303f39e870ad465511443265282568c 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
@@ -126,6 +126,10 @@ Background = function() {
if (!chrome.accessibilityPrivate.setKeyboardListener)
chrome.accessibilityPrivate.setKeyboardListener = function() {};
+
+ var focus = chrome.automation.getFocus();
+ if (focus)
+ this.setCurrentRange(cursors.Range.fromNode(focus));
};
Background.prototype = {
@@ -190,6 +194,21 @@ Background.prototype = {
cvox.ChromeVox.earcons.cancelEarcon(cvox.Earcon.PAGE_START_LOADING);
}
+ // 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_) {
+ var focus = chrome.automation.getFocus();
+ if (focus)
+ this.setCurrentRange(cursors.Range.fromNode(focus));
+ }
+
this.mode_ = mode;
},
@@ -465,6 +484,12 @@ 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
David Tseng 2016/01/28 02:00:56 Maybe add something to queue the next utterance?
dmazzoni 2016/01/30 00:02:41 For Classic? Did you have something specific in mi
+ // anything more.
+ if (newMode == ChromeVoxMode.CLASSIC)
+ return false;
+
David Tseng 2016/01/28 02:00:56 nit: extra line
dmazzoni 2016/01/30 00:02:41 Done.
break;
case 'toggleStickyMode':
cvox.ChromeVoxBackground.setPref('sticky',

Powered by Google App Engine
This is Rietveld 408576698