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

Unified Diff: chrome/browser/resources/settings/site_settings/site_list.js

Issue 2791053002: MD Settings: Restore focus after closing dialogs, for content settings. (Closed)
Patch Set: Nit. Created 3 years, 9 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 | « chrome/browser/resources/settings/site_settings/site_list.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/site_settings/site_list.js
diff --git a/chrome/browser/resources/settings/site_settings/site_list.js b/chrome/browser/resources/settings/site_settings/site_list.js
index 69395918cf11de3416d2917ceb3693c6b368061b..82d5580fe5c768f19752bd5b578d3f8406dbe9b2 100644
--- a/chrome/browser/resources/settings/site_settings/site_list.js
+++ b/chrome/browser/resources/settings/site_settings/site_list.js
@@ -108,6 +108,12 @@ Polymer({
},
},
+ /**
+ * The element to return focus to, when the currntly active dialog is closed.
+ * @private {?HTMLElement}
+ */
+ activeDialogAnchor_: null,
+
observers: ['configureWidget_(category, categorySubtype)'],
ready: function() {
@@ -215,8 +221,9 @@ Polymer({
dialog.open(this.categorySubtype);
dialog.addEventListener('close', function() {
+ this.$.addSite.focus();
dialog.remove();
- });
+ }.bind(this));
},
/**
@@ -435,6 +442,8 @@ Polymer({
onEditExceptionDialogClosed_: function() {
this.showEditExceptionDialog_ = false;
this.actionMenuSite_ = null;
+ this.activeDialogAnchor_.focus();
+ this.activeDialogAnchor_ = null;
},
/** @private */
@@ -474,16 +483,18 @@ Polymer({
* @private
*/
onShowActionMenuTap_: function(e) {
+ this.activeDialogAnchor_ = /** @type {!HTMLElement} */ (
+ Polymer.dom(/** @type {!Event} */ (e)).localTarget);
dschuyler 2017/04/03 21:44:56 There's a lot of text for a simple "A = B" line. C
dpapad 2017/04/03 23:42:09 Tried changing the @param to "{!Event|!{model: !{i
+
this.actionMenuSite_ = e.model.item;
/** @type {!CrActionMenuElement} */ (
- this.$$('dialog[is=cr-action-menu]')).showAt(
- /** @type {!Element} */ (
- Polymer.dom(/** @type {!Event} */ (e)).localTarget));
+ this.$$('dialog[is=cr-action-menu]')).showAt(this.activeDialogAnchor_);
},
/** @private */
closeActionMenu_: function() {
this.actionMenuSite_ = null;
+ this.activeDialogAnchor_ = null;
var actionMenu = /** @type {!CrActionMenuElement} */ (
this.$$('dialog[is=cr-action-menu]'));
if (actionMenu.open)
« no previous file with comments | « chrome/browser/resources/settings/site_settings/site_list.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698