Implicit form submit doesn’t work in Ionic 4

Bug Report


Describe the Bug

I created a login form (started with the Ionic Stencil PWA Starter) using form, ion-input and ion-button. When I try to implicitly submit the form by pressing enter in one of the inputs, the form does not get submitted, despite my button having the type="submit" attribute set.

Steps to Reproduce

  1. Create a form
  2. Focus on one of the inputs
  3. Press enter
  4. Nothing happens

Related Code


  <form onSubmit={e => this.submitLogin(e)}>
      <ion-label position="stacked">
      <ion-input name="username" type="email" placeholder="" required autofocus />
      <ion-label position="stacked">
      <ion-input name="password" type="password" placeholder="********" required />

    <ion-button type="submit" color="primary">
      <ion-icon slot="end" name="log-in" />
      Log In

Expected Behavior

The implicit form submit should work because the form contains a button with type="submit".

Additional Context

Author: Fantashit

2 thoughts on “Implicit form submit doesn’t work in Ionic 4

  1. I think that a more permanent solution may be in order — this is standard / expected behavior. This would require implementing a (keyup.enter) on every form input that performed the form submission and dismissed the keyboard as necessary. You would also have to duplicate the form submission handling for (ngSubmit) because users could still tap the submit button itself.

  2. @simonhaenisch Thanks for your response. I will not open this issue because we already have two which seperate this issues very well:

    #15136: Button does not trigger ngSubmit
    #16498: Prev / Next button on mobile keyboard

    So it’s not useful to have different issues opened for the same topic. Is that okay for you 🙂

Comments are closed.