From ad358375b8bb897ad97765d5b85d29d211b41acb Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Mon, 10 Jul 2017 13:09:11 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20enter=20key=20not=20workin?= =?UTF-8?q?g=20in=20text=20inputs/areas=20(#771)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes https://github.com/TryGhost/Ghost/issues/8588, closes https://github.com/TryGhost/Ghost/issues/8639 - check that we have an action assigned to keyEvent codes before attempting to prevent the default behaviour - no tests because browsers don't trigger form submissions in response to JS key events as a security measure --- ghost/admin/app/mixins/text-input.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ghost/admin/app/mixins/text-input.js b/ghost/admin/app/mixins/text-input.js index 2aceca01dd..0f184ca8b0 100644 --- a/ghost/admin/app/mixins/text-input.js +++ b/ghost/admin/app/mixins/text-input.js @@ -39,7 +39,7 @@ export default Mixin.create({ } // prevent default TAB behaviour if we have a keyEvent for it - if (event.keyCode === 9 && this.get('keyEvents.9')) { + if (event.keyCode === 9 && typeof this.get('keyEvents.9') === 'function') { event.preventDefault(); } @@ -48,7 +48,7 @@ export default Mixin.create({ keyPress(event) { // prevent default ENTER behaviour if we have a keyEvent for it - if (event.keyCode === 13 && this.get('keyEvents.13')) { + if (event.keyCode === 13 && typeof this.get('keyEvents.13') === 'function') { event.preventDefault(); }