I would like to know if it is possible to use enter key to go to next step & submit form.
Fill the step, press enter, go to next step
Complete all steps, press enter, submit the form.
https://stackblitz.com/angular/vnqarakmxkx
When I filled the step 1, pressed enter, stepper navigated to 2nd step.
When I filled the step 2, pressed enter, stepper navigated back to 1st step.
Providing a StackBlitz/Plunker (or similar) is the best way to get the team to see your issue.
Plunker starter (using on @master): https://goo.gl/uDmqyY
StackBlitz starter (using latest npm release): https://goo.gl/wwnhMV
That's possible. By default, both buttons in the second step are submit buttons. If you set type="button" on the back button, the next button will be triggered on enter press.
<button type="button" mat-button matStepperPrevious>Back</button>
<button type="submit" mat-button matStepperNext>Next</button>
I think it would make sense to always treat matStepperPrevious as normal buttons, and always set type="submit" for buttons with matStepperNext.
Thanks @DevVersion
The Enter key works perfectly after adding button type.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
That's possible. By default, both buttons in the second step are
submitbuttons. If you settype="button"on the back button, the next button will be triggered on enter press.I think it would make sense to always treat
matStepperPreviousas normal buttons, and always settype="submit"for buttons withmatStepperNext.