diff --git a/core/client/components/gh-blur-input.js b/core/client/components/gh-blur-input.js index 8a01b59f70..84d771a6d2 100644 --- a/core/client/components/gh-blur-input.js +++ b/core/client/components/gh-blur-input.js @@ -1,5 +1,6 @@ var BlurInput = Ember.TextField.extend({ selectOnClick: false, + stopEnterKeyDownPropagation: false, click: function (event) { if (this.get('selectOnClick')) { event.currentTarget.select(); @@ -7,6 +8,15 @@ var BlurInput = Ember.TextField.extend({ }, focusOut: function () { this.sendAction('action', this.get('value')); + }, + keyDown: function (event) { + // stop event propagation when pressing "enter" + // most useful in the case when undesired (global) keyboard shortcuts are getting triggered while interacting + // with this particular input element. + if (this.get('stopEnterKeyDownPropagation') && event.keyCode === 13) { + event.stopPropagation(); + return true; + } } }); diff --git a/core/client/templates/post-settings-menu.hbs b/core/client/templates/post-settings-menu.hbs index 04f2a578c6..a0628f1804 100644 --- a/core/client/templates/post-settings-menu.hbs +++ b/core/client/templates/post-settings-menu.hbs @@ -6,7 +6,7 @@ - {{gh-blur-input class="post-setting-slug" id="url" value=slugValue name="post-setting-slug" action="updateSlug" placeholder=slugPlaceholder selectOnClick="true"}} + {{gh-blur-input class="post-setting-slug" id="url" value=slugValue name="post-setting-slug" action="updateSlug" placeholder=slugPlaceholder selectOnClick="true" stopEnterKeyDownPropagation="true"}} @@ -14,7 +14,7 @@ - {{gh-blur-input class="post-setting-date" value=publishedAtValue name="post-setting-date" action="setPublishedAt" placeholder=publishedAtPlaceholder}} + {{gh-blur-input class="post-setting-date" value=publishedAtValue name="post-setting-date" action="setPublishedAt" placeholder=publishedAtPlaceholder stopEnterKeyDownPropagation="true"}}