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

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: toggle 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..e37ae39b7422ff390b11dab540a7f70371bf84de 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,29 @@ 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() {
+ // Call this instead of ExtensionSettings.focusOverlay() because
+ // <extensionoptions> is already the active element. TODO(dbeam): why
+ // do we need to re-focus <extensionoptions> after its showing animation
+ // finishes? Makes very little sense to me.
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();
},
};

Powered by Google App Engine
This is Rietveld 408576698