components icon indicating copy to clipboard operation
components copied to clipboard

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

Open fengmao opened this issue 6 years ago • 8 comments
trafficstars

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?

fengmao avatar Apr 25 '19 03:04 fengmao

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

swseverance avatar May 03 '19 20:05 swseverance

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

dinlal1990 avatar Apr 07 '21 20:04 dinlal1990

This is work for me Thanks @swseverance

niralishah1599 avatar Oct 12 '21 06:10 niralishah1599

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] avatar Feb 21 '22 15:02 angular-robot[bot]

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.

angular-robot[bot] avatar Mar 13 '22 15:03 angular-robot[bot]

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

muneebkq avatar Jul 01 '22 09:07 muneebkq

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.

liesahead avatar Aug 01 '24 06:08 liesahead

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.

boycany avatar Sep 13 '24 09:09 boycany

a workaround i came up with:

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

uaman89 avatar Nov 28 '24 16:11 uaman89