Keyboard return fires "go back" or ionViewCanLeave

When I am in an input field and the keyboard raises to type something, when I push on return on my keyboard, then it fires a go back event and also the ionViewCanLeave event.

But I use the ionViewCanLeave event when you press the go back arrow in the navbar to ask the question if you’re sure to skip the changes…


Is there a possibility when I click on return that he closes the keyboard instead of firing another thing?

Is that the right way?

document.onkeydown = (k) => {
     if (k.keyCode == 13) {
          return false;