| 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';
|
|
|