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

Unified Diff: chrome/browser/resources/options/autofill_edit_creditcard_overlay.js

Issue 516403003: Focus the first input when adding a new Autofill cc or address (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/options/autofill_edit_creditcard_overlay.js
diff --git a/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js b/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js
index 4458ecc17616bb2a1135f50a6f70d08b80928f07..ac2a404241b22ab98841e89513e6a6a835da9ecb 100644
--- a/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js
+++ b/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js
@@ -180,10 +180,17 @@ cr.define('options', function() {
/**
* Loads the credit card data from |creditCard|, sets the input fields based
- * on this data and stores the GUID of the credit card.
+ * on this data and stores the GUID of the credit card. If |creditCard| is
+ * null, this is an "Add New" dialog. Focus the first field.
* @private
*/
loadCreditCard_: function(creditCard) {
+ if (!creditCard) {
+ // Adding a new card --- focus the first element.
+ this.pageDiv.querySelector('input').focus();
+ return;
+ }
+
this.setInputFields_(creditCard);
this.inputFieldChanged_();
this.guid_ = creditCard.guid;

Powered by Google App Engine
This is Rietveld 408576698