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

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

Issue 2412433004: Recovery: Implement focus recovery across root AutomationNodes (Closed)
Patch Set: Created 4 years, 2 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/panel.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
index 60133570e9f67c0957f4b0783c87f0aa401343a4..1ebb60ee75184e613b8da8ddbd067894e63c3388 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
@@ -617,24 +617,30 @@ Panel.getCallbackForCurrentItem = function() {
* was queued, execute it once focus is restored.
*/
Panel.closeMenusAndRestoreFocus = function() {
- // Make sure we're not in full-screen mode.
- window.location = '#';
-
- this.activeMenu_ = null;
+ // Watch for the next focus event.
+ var desktop = null;
+ var onFocus = function(evt) {
dmazzoni 2016/10/11 17:41:18 Rather than add and remove a focus listener, what
David Tseng 2016/10/11 21:24:32 I'd like to limit the panel's global event listene
+ desktop.removeEventListener(chrome.automation.EventType.focus, onFocus);
+ Panel.pendingCallback_ && Panel.pendingCallback_();
+ }.bind(this);
+
+ chrome.automation.getDesktop(function(node) {
dmazzoni 2016/10/11 17:41:18 How about: getDesktop(function(desktop) {
David Tseng 2016/10/11 21:24:32 desktop is used above. I guess I could bind it to
+ desktop = node;
+ desktop.addEventListener(chrome.automation.EventType.focus,
+ onFocus,
+ true);
+
+ // Make sure we're not in full-screen mode.
+ window.location = '#';
- var bkgnd =
- chrome.extension.getBackgroundPage()['ChromeVoxState']['instance'];
- bkgnd['endExcursion'](Panel.pendingCallback_);
+ this.activeMenu_ = null;
+ });
};
/**
* Open the tutorial.
*/
Panel.onTutorial = function() {
- var bkgnd =
- chrome.extension.getBackgroundPage()['ChromeVoxState']['instance'];
- bkgnd['startExcursion']();
-
// Change the url fragment to 'fullscreen', which signals the native
// host code to make the window fullscreen, revealing the menus.
window.location = '#fullscreen';

Powered by Google App Engine
This is Rietveld 408576698