Components: MatInput: (keyup.enter) calling matPrefix method

Created on 6 May 2018  路  1Comment  路  Source: angular/components

Bug, feature request, or proposal:

Bug

What is the expected behavior?

on matInput when you press enter(keyup.enter)="myFunction(), it should NOT calls click method on matPrefix

What is the current behavior?

method (keyup.enter)="myFunction() on matInput first calling method on matPrefix, then method on input.

What are the steps to reproduce?

  1. Try to type anything, then press enter
  2. See console (first calls click method on matPrefix, then on matInput)

https://stackblitz.com/edit/angular-wxpesf?file=app%2Finput-prefix-suffix-example.ts

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Material 6.0.0, all Browsers

Most helpful comment

Isn't that the default behavior of html forms? Any button inside a form that doesn't explicitly have type="button" will trigger the form submission.

>All comments

Isn't that the default behavior of html forms? Any button inside a form that doesn't explicitly have type="button" will trigger the form submission.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kara picture kara  路  3Comments

alanpurple picture alanpurple  路  3Comments

vitaly-t picture vitaly-t  路  3Comments

vanor89 picture vanor89  路  3Comments

Miiekeee picture Miiekeee  路  3Comments