Chromium Code Reviews| Index: chrome/browser/resources/settings/people_page/sync_page.js |
| diff --git a/chrome/browser/resources/settings/people_page/sync_page.js b/chrome/browser/resources/settings/people_page/sync_page.js |
| index 3c99f727e1b1a77128cf79da716a5f2a07918082..409e37eae8bcd6660bf0c9288fad440beb826b59 100644 |
| --- a/chrome/browser/resources/settings/people_page/sync_page.js |
| +++ b/chrome/browser/resources/settings/people_page/sync_page.js |
| @@ -293,10 +293,19 @@ Polymer({ |
| /** |
| * Sends the newly created custom sync passphrase to the browser. |
| * @private |
| + * @param {!{target: !{tagName: string}, |
| + * type: string, |
| + * key: (string|undefined)}} e |
|
Dan Beam
2017/05/16 02:20:55
KeyboardEvent?
tommycli
2017/05/16 16:17:53
Done. I used Event because it could be a mouse eve
|
| */ |
| - onSaveNewPassphraseTap_: function() { |
| + onSaveNewPassphraseTap_: function(e) { |
| assert(this.creatingNewPassphrase_); |
| + // Ignore events on irrevelant elements or with irrelevant keys. |
| + if (e.target.tagName != 'PAPER-BUTTON' && e.target.tagName != 'PAPER-INPUT') |
| + return; |
| + if (e.type == 'keypress' && e.key != 'Enter') |
| + return; |
| + |
| // If a new password has been entered but it is invalid, do not send the |
| // sync state to the API. |
| if (!this.validateCreatedPassphrases_()) |
| @@ -313,8 +322,12 @@ Polymer({ |
| /** |
| * Sends the user-entered existing password to re-enable sync. |
| * @private |
| + * @param {Event} e |
| */ |
| - onSubmitExistingPassphraseTap_: function() { |
| + onSubmitExistingPassphraseTap_: function(e) { |
| + if (e.type == 'keypress' && e.key != 'Enter') |
| + return; |
| + |
| assert(!this.creatingNewPassphrase_); |
| this.syncPrefs.setNewPassphrase = false; |