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

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

Issue 2882143003: MD Settings: Improve Sync Page Enter key handling. (Closed)
Patch Set: fix type def 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..8078686bd65191aa99cdd123b62bb0a8c771bf77 100644
--- a/chrome/browser/resources/settings/people_page/sync_page.js
+++ b/chrome/browser/resources/settings/people_page/sync_page.js
@@ -293,10 +293,17 @@ Polymer({
/**
* Sends the newly created custom sync passphrase to the browser.
* @private
+ * @param {Event} e
*/
- 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 +320,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