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

Unified Diff: chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js

Issue 2789783002: MD Settings: Restore focus after closing dialogs, for passwords page. (Closed)
Patch Set: fix compilation 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
Index: chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js
diff --git a/chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js b/chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js
index fcd03d468047c9bac6ac5cfec67f2d3151df3515..cc1a2d8a72f55e80858b8888eb7cde1788b6cc26 100644
--- a/chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js
+++ b/chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.js
@@ -191,6 +191,13 @@ AutofillManagerImpl.prototype = {
},
/**
+ * The element to return focus to, when the currently active dialog is
+ * closed.
+ * @private {?HTMLElement}
+ */
+ activeDialogAnchor_: null,
+
+ /**
* @type {AutofillManager}
* @private
*/
@@ -277,6 +284,7 @@ AutofillManagerImpl.prototype = {
var dotsButton = /** @type {!HTMLElement} */ (Polymer.dom(e).localTarget);
/** @type {!CrActionMenuElement} */ (
this.$.addressSharedMenu).showAt(dotsButton);
+ this.activeDialogAnchor_ = dotsButton;
},
/**
@@ -288,11 +296,14 @@ AutofillManagerImpl.prototype = {
e.preventDefault();
this.activeAddress = {};
this.showAddressDialog_ = true;
+ this.activeDialogAnchor_ = this.$.addAddress;
},
/** @private */
onAddressDialogClosed_: function() {
this.showAddressDialog_ = false;
+ this.activeDialogAnchor_.focus();
+ this.activeDialogAnchor_ = null;
},
/**
@@ -341,6 +352,7 @@ AutofillManagerImpl.prototype = {
var dotsButton = /** @type {!HTMLElement} */ (Polymer.dom(e).localTarget);
/** @type {!CrActionMenuElement} */ (
this.$.creditCardSharedMenu).showAt(dotsButton);
+ this.activeDialogAnchor_ = dotsButton;
},
/**
@@ -357,11 +369,14 @@ AutofillManagerImpl.prototype = {
expirationYear: date.getFullYear().toString(),
};
this.showCreditCardDialog_ = true;
+ this.activeDialogAnchor_ = this.$.addCreditCard;
},
/** @private */
onCreditCardDialogClosed_: function() {
this.showCreditCardDialog_ = false;
+ this.activeDialogAnchor_.focus();
+ this.activeDialogAnchor_ = null;
},
/**

Powered by Google App Engine
This is Rietveld 408576698