Commit ea7257f1 authored by Esmael El-Moslimany's avatar Esmael El-Moslimany Committed by Commit Bot

Settings WebUI: manage-profile update profile name on route change,

cr-input skip validation when old and new values are both falsy

After validation, if the input value is invalid, the red underline will
be drawn under the input. When initializing the cr-input, the value
switches from undefined to '' and then it is updated to new values from
there. This causes an issue because the underline opacity and width
have transition. So if the value is valid after initialization, the
underline will appear blue and then transition away (the color change
is instant). This CL addresses this by skipping validation until a real
value has been set.

Bug: 907022
Change-Id: I2369cb41467c3d6ee9b3b30004188579df107906
Reviewed-on: https://chromium-review.googlesource.com/c/1345415Reviewed-by: default avatarScott Chen <scottchen@chromium.org>
Commit-Queue: Esmael El-Moslimany <aee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610200}
parent 64f6cbf8
...@@ -78,6 +78,8 @@ Polymer({ ...@@ -78,6 +78,8 @@ Polymer({
/** @protected */ /** @protected */
currentRouteChanged: function() { currentRouteChanged: function() {
if (settings.getCurrentRoute() == settings.routes.MANAGE_PROFILE) { if (settings.getCurrentRoute() == settings.routes.MANAGE_PROFILE) {
if (this.profileName)
this.$.name.value = this.profileName;
if (loadTimeData.getBoolean('profileShortcutsEnabled')) { if (loadTimeData.getBoolean('profileShortcutsEnabled')) {
this.browserProxy_.getProfileShortcutStatus().then(status => { this.browserProxy_.getProfileShortcutStatus().then(status => {
if (status == ProfileShortcutStatus.PROFILE_SHORTCUT_SETTING_HIDDEN) { if (status == ProfileShortcutStatus.PROFILE_SHORTCUT_SETTING_HIDDEN) {
......
...@@ -284,8 +284,14 @@ Polymer({ ...@@ -284,8 +284,14 @@ Polymer({
this.focus(); this.focus();
}, },
/** @private */ /**
onValueChanged_: function() { * @param {string} newValue
* @param {string} oldValue
* @private
*/
onValueChanged_: function(newValue, oldValue) {
if (!newValue && !oldValue)
return;
if (this.autoValidate) if (this.autoValidate)
this.validate(); this.validate();
}, },
......
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