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

Unified Diff: chrome/browser/resources/settings/people_page/sync_page.js

Issue 2882143003: MD Settings: Improve Sync Page Enter key handling. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « chrome/browser/resources/settings/people_page/sync_page.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « chrome/browser/resources/settings/people_page/sync_page.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698