angular / components

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

bug(Autocomplete): Autocomplete control once Opened is not getting closed for external actions like Page level scroll #20160

Open vamsibassetty08 opened 4 years ago

vamsibassetty08 commented 4 years ago

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/angular/rlqaadnpmxqd?file=app%2Fautocomplete-overview-example.ts Tried with focusout event: https://stackblitz.com/edit/angular-jfuvpb?file=app%2Fautocomplete-overview-example.html

Steps to reproduce:

  1. Click on Autocomplete control and let it stay expanded.

  2. try to do page level scroll to the bottom (https://v7.material.angular.io/components/autocomplete/examples), the Autocomplete control doesn't collapse/close.

  3. I've tried to place focusout event as in the example (https://stackblitz.com/edit/angular-jfuvpb?file=app%2Fautocomplete-overview-example.html), even though the Autocomplete control collapses on Page level scroll click (https://stackblitz.com/edit/angular-jfuvpb?file=app%2Fautocomplete-overview-example.ts) but on more issue came up like the selected option doesn't apply to Autocomplete control.

Expected Behavior

On any action outside of the Autocomplete control e.g., Page level scroll should close the Autocomplete control

Actual Behavior

The Autocomplete control stays expanded and is not user friendly behavior.

Environment

I've observed this in all Angular versions greater than 7.

wagnermaciel commented 4 years ago

Marking as needs discussion since this is part of a broader discussion around how to configure scroll strategy for all the overlay based components.