Index: chrome/browser/resources/extensions/extension_list.js |
diff --git a/chrome/browser/resources/extensions/extension_list.js b/chrome/browser/resources/extensions/extension_list.js |
index b8ab0d4a66a37583a7a6017dad241355cc6a3d44..580dfe6c4b11aaf37df8d5ac6bb44af93144239e 100644 |
--- a/chrome/browser/resources/extensions/extension_list.js |
+++ b/chrome/browser/resources/extensions/extension_list.js |
@@ -567,20 +567,35 @@ cr.define('options', function() { |
if (scroll) |
this.scrollToNode_(extensionId); |
+ |
// Add the options query string. Corner case: the 'options' query string |
// will clobber the 'id' query string if the options link is clicked when |
// 'id' is in the URL, or if both query strings are in the URL. |
uber.replaceState({}, '?options=' + extensionId); |
- extensions.ExtensionOptionsOverlay.getInstance(). |
- setExtensionAndShowOverlay(extensionId, |
- extension.name, |
- extension.icon); |
- |
+ var overlay = extensions.ExtensionOptionsOverlay.getInstance(); |
+ overlay.setExtensionAndShowOverlay(extensionId, extension.name, |
+ extension.icon); |
this.optionsShown_ = true; |
- $('overlay').addEventListener('cancelOverlay', function() { |
- this.optionsShown_ = false; |
- }.bind(this)); |
+ |
+ if (cr.ui.FocusOutlineManager.forDocument(document).visible) |
+ overlay.setInitialFocus(); |
+ else |
+ document.activeElement.blur(); |
+ |
+ var self = this; |
+ |
+ $('overlay').addEventListener('animationFinished', function f() { |
not at google - send to devlin
2015/02/03 20:52:04
Consider commenting that the animation is started
Dan Beam
2015/02/04 17:15:38
Done.
|
+ overlay.setInitialFocus(); |
+ $('overlay').removeEventListener('animationFinished', f); |
+ }); |
+ |
+ $('overlay').addEventListener('cancelOverlay', function f() { |
+ // Restore initial focus once this page isn't rebuild crazy. |
+ // http://crbug.com/450818 |
+ self.optionsShown_ = false; |
+ $('overlay').removeEventListener('cancelOverlay', f); |
+ }); |
}, |
}; |