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

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

Issue 862403006: extensions: fix focus management for all dialogs (not just options). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@classList-fix
Patch Set: kalman@ review 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
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 e0216a315f781285046447766db41a47b3cd7df0..1656bdc1f5869be06b919f9f3882b8ff61efb1e9 100644
--- a/chrome/browser/resources/extensions/extension_list.js
+++ b/chrome/browser/resources/extensions/extension_list.js
@@ -133,10 +133,8 @@ cr.define('options', function() {
if (idToOpenOptions && $(idToOpenOptions))
this.showEmbeddedExtensionOptions_(idToOpenOptions, true);
- if (this.data_.extensions.length == 0)
- this.classList.add('empty-extension-list');
- else
- this.classList.remove('empty-extension-list');
+ var noExtensions = this.data_.extensions.length == 0;
+ this.classList.toggle('empty-extension-list', noExtensions);
},
/**
@@ -568,36 +566,31 @@ 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);
+ var overlay = extensions.ExtensionOptionsOverlay.getInstance();
var shownCallback = function() {
+ // This overlay doesn't get focused automatically as <extensionoptions>
+ // is created after the overlay is shown.
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;
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();
+ // TODO(dbeam): why do we need to focus <extensionoptions> before and
+ // after its showing animation? Makes very little sense to me.
+ overlay.setInitialFocus();
},
};

Powered by Google App Engine
This is Rietveld 408576698