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

Unified Diff: chrome/browser/resources/extensions/extension_list.js

Issue 900623003: extensions: focus options overlay content when shown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@policy-icon-label
Patch Set: blur() just in case Created 5 years, 10 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 | « no previous file | chrome/browser/resources/extensions/extension_options_overlay.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e0216a315f781285046447766db41a47b3cd7df0 100644
--- a/chrome/browser/resources/extensions/extension_list.js
+++ b/chrome/browser/resources/extensions/extension_list.js
@@ -567,20 +567,37 @@ cr.define('options', function() {
if (scroll)
this.scrollToNode_(extensionId);
+
+ document.activeElement.blur();
+
// 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 shownCallback = function() {
+ if (cr.ui.FocusOutlineManager.forDocument(document).visible)
+ overlay.setInitialFocus();
+ };
+ var overlay = extensions.ExtensionOptionsOverlay.getInstance();
+ overlay.setExtensionAndShowOverlay(extensionId, extension.name,
+ extension.icon, shownCallback);
this.optionsShown_ = true;
- $('overlay').addEventListener('cancelOverlay', function() {
- this.optionsShown_ = false;
- }.bind(this));
+
+ var self = this;
+ $('overlay').addEventListener('cancelOverlay', function f() {
+ // Restore focus instead of just blurring when this page isn't rebuild
+ // crazy. http://crbug.com/450818
+ document.activeElement.blur();
+ self.optionsShown_ = false;
+ $('overlay').removeEventListener('cancelOverlay', f);
+ });
+
+ // TODO(dbeam): guestview's focus is weird. Only when this is called from
+ // within this event handler *and* after the showing animation completes
+ // does this work.
+ shownCallback();
},
};
« no previous file with comments | « no previous file | chrome/browser/resources/extensions/extension_options_overlay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698