angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.23k stars 6.7k forks source link

blur() events ignored on mat-autocomplete #9061

Open yoonjesung opened 6 years ago

yoonjesung commented 6 years ago

Bug, feature request, or proposal:

feature/proposal

What is the expected behavior?

onblur() events on the containing input should close autocomplete.

What is the current behavior?

blur events on input don't get caught by autocomplete directive

What are the steps to reproduce?

Example of input blurred on enter keypress but autocomplete staying open: https://stackblitz.com/edit/angular-material2-issue-gmeqgc?file=app%2Fapp.component.ts

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

Using build 5.0.0 of material

yoonjesung commented 6 years ago

Sorry, did not look at the MatAutocompleteTrigger methods closely enough.

Realized that you can programmatically close a trigger by using the closePanel() method in MatAutocompleteTrigger and using it as a ViewChild in the component.

However, might be worth considering about how the MatAutocompleteTrigger should react to other programatic blur events?