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

Miiekeee picture Miiekeee  路  3Comments

julianobrasil picture julianobrasil  路  3Comments

savaryt picture savaryt  路  3Comments

RoxKilly picture RoxKilly  路  3Comments

Hiblton picture Hiblton  路  3Comments