Commit 2fad815b authored by estade's avatar estade Committed by Commit bot

Focus the first input when adding a new Autofill cc or address

in chrome://settings

It was mentioned that this was desirable behavior for desktop during the UX review for the linked bug.

BUG=407209

Review URL: https://codereview.chromium.org/516403003

Cr-Commit-Position: refs/heads/master@{#293040}
parent 70b215c8
...@@ -324,6 +324,15 @@ cr.define('options', function() { ...@@ -324,6 +324,15 @@ cr.define('options', function() {
} }
}, },
/**
* Called to prepare the overlay when a new address is being added.
* @private
*/
prepForNewAddress_: function() {
// Focus the first element.
this.pageDiv.querySelector('input').focus();
},
/** /**
* Loads the address data from |address|, sets the input fields based on * Loads the address data from |address|, sets the input fields based on
* this data, and stores the GUID and language code of the address. * this data, and stores the GUID and language code of the address.
...@@ -407,6 +416,10 @@ cr.define('options', function() { ...@@ -407,6 +416,10 @@ cr.define('options', function() {
}, },
}; };
AutofillEditAddressOverlay.prepForNewAddress = function() {
AutofillEditAddressOverlay.getInstance().prepForNewAddress_();
};
AutofillEditAddressOverlay.loadAddress = function(address) { AutofillEditAddressOverlay.loadAddress = function(address) {
AutofillEditAddressOverlay.getInstance().loadAddress_(address); AutofillEditAddressOverlay.getInstance().loadAddress_(address);
}; };
......
...@@ -178,6 +178,15 @@ cr.define('options', function() { ...@@ -178,6 +178,15 @@ cr.define('options', function() {
} }
}, },
/**
* Called to prepare the overlay when a new card is being added.
* @private
*/
prepForNewCard_: function() {
// Focus the first element.
this.pageDiv.querySelector('input').focus();
},
/** /**
* Loads the credit card data from |creditCard|, sets the input fields based * 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.
...@@ -190,6 +199,10 @@ cr.define('options', function() { ...@@ -190,6 +199,10 @@ cr.define('options', function() {
}, },
}; };
AutofillEditCreditCardOverlay.prepForNewCard = function() {
AutofillEditCreditCardOverlay.getInstance().prepForNewCard_();
};
AutofillEditCreditCardOverlay.loadCreditCard = function(creditCard) { AutofillEditCreditCardOverlay.loadCreditCard = function(creditCard) {
AutofillEditCreditCardOverlay.getInstance().loadCreditCard_(creditCard); AutofillEditCreditCardOverlay.getInstance().loadCreditCard_(creditCard);
}; };
......
...@@ -104,6 +104,7 @@ cr.define('options', function() { ...@@ -104,6 +104,7 @@ cr.define('options', function() {
var title = loadTimeData.getString('addAddressTitle'); var title = loadTimeData.getString('addAddressTitle');
AutofillEditAddressOverlay.setTitle(title); AutofillEditAddressOverlay.setTitle(title);
PageManager.showPageByName('autofillEditAddress'); PageManager.showPageByName('autofillEditAddress');
AutofillEditAddressOverlay.prepForNewAddress();
}, },
/** /**
...@@ -115,6 +116,7 @@ cr.define('options', function() { ...@@ -115,6 +116,7 @@ cr.define('options', function() {
var title = loadTimeData.getString('addCreditCardTitle'); var title = loadTimeData.getString('addCreditCardTitle');
AutofillEditCreditCardOverlay.setTitle(title); AutofillEditCreditCardOverlay.setTitle(title);
PageManager.showPageByName('autofillEditCreditCard'); PageManager.showPageByName('autofillEditCreditCard');
AutofillEditCreditCardOverlay.prepForNewCard();
}, },
/** /**
...@@ -181,8 +183,8 @@ cr.define('options', function() { ...@@ -181,8 +183,8 @@ cr.define('options', function() {
/** /**
* Shows the 'Edit credit card' overlay, using the data in |credit_card| to * Shows the 'Edit credit card' overlay, using the data in |credit_card| to
* fill the input fields. |address| is a list with one item, an associative * fill the input fields. |creditCard| is a list with one item, an
* array that contains the credit card data. * associative array that contains the credit card data.
* @private * @private
*/ */
showEditCreditCardOverlay_: function(creditCard) { showEditCreditCardOverlay_: function(creditCard) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment