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

Unified Diff: chrome/browser/resources/settings/controls/settings_input.js

Issue 2752373003: MD Settings: Make Escape blur and undo changes to input fields. (Closed)
Patch Set: fix Created 3 years, 9 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/settings/controls/settings_input.js
diff --git a/chrome/browser/resources/settings/controls/settings_input.js b/chrome/browser/resources/settings/controls/settings_input.js
index 2b39de17ee3aca1f497743fe5ef522a82f8d7bee..ea075476fe84ae7cda2a7d7c44a5a93eb1072565 100644
--- a/chrome/browser/resources/settings/controls/settings_input.js
+++ b/chrome/browser/resources/settings/controls/settings_input.js
@@ -70,6 +70,11 @@ Polymer({
if (this.$.input.focused)
return;
+ this.setInputValueFromPref_();
+ },
+
+ /** @private */
+ setInputValueFromPref_: function() {
if (this.pref.type == chrome.settingsPrivate.PrefType.NUMBER) {
this.value = this.pref.value.toString();
} else {
@@ -118,6 +123,19 @@ Polymer({
},
/**
+ * Handler for profile name keydowns.
+ * @param {!Event} event
+ * @private
+ */
+ onKeydown_: function(event) {
+ if (event.key != 'Escape')
+ return;
+
+ this.setInputValueFromPref_();
+ this.$.input.blur();
+ },
+
+ /**
* @param {boolean} disabled
* @return {boolean} Whether the element should be disabled.
* @private

Powered by Google App Engine
This is Rietveld 408576698