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

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

Issue 2412433004: Recovery: Implement focus recovery across root AutomationNodes (Closed)
Patch Set: Address feedback. 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
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/i_search.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..15599ed032733b85a05ece9f20f9ff334a266e44 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
@@ -617,24 +617,33 @@ 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 = '#';
+ // Watch for the next focus event.
+ var onFocus = function(desktop, evt) {
+ desktop.removeEventListener(chrome.automation.EventType.focus, onFocus);
+ Panel.pendingCallback_ && Panel.pendingCallback_();
+ }.bind(this);
- this.activeMenu_ = null;
+ chrome.automation.getDesktop(function(desktop) {
+ onFocus = /** @type {function(chrome.automation.AutomationEvent)} */(
+ onFocus.bind(this, desktop));
+ desktop.addEventListener(chrome.automation.EventType.focus,
+ onFocus,
+ true);
- var bkgnd =
- chrome.extension.getBackgroundPage()['ChromeVoxState']['instance'];
- bkgnd['endExcursion'](Panel.pendingCallback_);
+ // Make sure all menus are cleared to avoid bogous output when we re-open.
+ Panel.clearMenus();
+
+ // Make sure we're not in full-screen mode.
+ window.location = '#';
+
+ 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';
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/i_search.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698