Chromium Code Reviews| 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) |