angular / components

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

how to keep autocomplete panel open when click outside the panel without select option? #15899

Open fengmao opened 5 years ago

fengmao commented 5 years ago

Bug, feature request, or proposal:

this is a feature request

What is the expected behavior?

i want to keep autocomplete panel open when click outside the panel without select an option

What is the current behavior?

the panel is closed when click outside

What are the steps to reproduce?

https://stackblitz.com/angular/ynbmnnrjolq

What is the use-case or motivation for changing an existing behavior?

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

i work with angular 7.x

Is there anything else we should know?

swseverance commented 5 years ago

@fengmao you can use this approach https://stackblitz.com/edit/angular-5j9ujv?embed=1&file=app/autocomplete-overview-example.ts

dinlal1990 commented 3 years ago

@fengmao : were you bale to find a solution for this ?

niralishah1599 commented 3 years ago

This is work for me Thanks @swseverance

angular-robot[bot] commented 2 years ago

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

angular-robot[bot] commented 2 years ago

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

muneebkq commented 2 years ago

can we make autocomplete render inside cdkoverlay so that when selecting an option of autocomplete it doesn't run (overlayOutsideClick) output property of OVERLAY.

liesahead commented 4 months ago

It's still relevant in v17 at least. I expected the MatAutocompleteSelectedEvent to hold the source event with possibility to prevent default (closing the panel), but it does not.

boycany commented 2 months ago

I also would like to know how to keep autocomplete panel open after selected the option... I tried so many ways, it seems didn't work in autocomplete.

uaman89 commented 1 week ago

a workaround i came up with:

@for(option of options){
<mat-option>
  <div class="wrapper" (click)="$event.stopPropagation(); yourOptionSelectHandler(option)">
     ....
  </div>
</mat-option
}