0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

🐛 fix enter key not working in text inputs/areas (#771)

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
This commit is contained in:
Kevin Ansfield 2017-07-10 13:09:11 +01:00 committed by Aileen Nowak
parent 1d3a9a692d
commit ad358375b8

View file

@ -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();
}