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

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

Issue 819193003: Fix list focus after tab key in chrome://settings/autofillEditAddress page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests. Created 5 years, 11 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_options_list.js
diff --git a/chrome/browser/resources/options/autofill_options_list.js b/chrome/browser/resources/options/autofill_options_list.js
index e45eb49d2d6351624f621f4821cc37b93f576c41..ac33d94631a12f45bb26446f67694960859cc45e 100644
--- a/chrome/browser/resources/options/autofill_options_list.js
+++ b/chrome/browser/resources/options/autofill_options_list.js
@@ -208,15 +208,21 @@ cr.define('options.autofillOptions', function() {
if (this.isPlaceholder) {
// It is important that updateIndex is done before validateAndSave.
// Otherwise we can not be sure about AddRow index.
+ this.list.eventsDisabled = true;
James Hawkins 2015/01/14 17:32:52 This seems really fragile. I'm really not confide
bondd 2015/01/14 23:13:54 I like it because its effect is guaranteed to be l
this.list.dataModel.updateIndex(i);
+ this.list.eventsDisabled = false;
this.list.validateAndSave(i, 0, value);
} else {
this.list.validateAndSave(i, 1, value);
}
} else {
// Reject empty values and duplicates.
- if (!this.isPlaceholder)
+ if (!this.isPlaceholder) {
+ this.list.eventsDisabled = true;
this.list.dataModel.splice(i, 1);
+ this.list.eventsDisabled = false;
+ this.list.setSelectedIndexWithoutFocusing(i);
+ }
else
this.clearValue_();
}
@@ -442,7 +448,10 @@ cr.define('options.autofillOptions', function() {
* @param {string} value The value of the item to insert.
*/
validateAndSave: function(index, remove, value) {
+ this.eventsDisabled = true;
this.dataModel.splice(index, remove, value);
+ this.eventsDisabled = false;
+ this.setSelectedIndexWithoutFocusing(index);
},
};
@@ -513,8 +522,6 @@ cr.define('options.autofillOptions', function() {
while (this.validationPromiseResolvers_.length) {
this.validationPromiseResolvers_.pop()();
}
- // List has been repopulated. Focus the placeholder.
- this.focusPlaceholder();
}
},

Powered by Google App Engine
This is Rietveld 408576698