fate icon indicating copy to clipboard operation
fate copied to clipboard

How to close dropdown

Open RFMV34 opened this issue 3 years ago • 5 comments

Hi, I would like to close dropdown, when user pick some option in dropdown. Is it possible? I have not find anything in code. Thanks!

RFMV34 avatar Aug 24 '21 10:08 RFMV34

I made workaround for this like Directive with: this.el.nativeElement.querySelector('.fate-ui-dropdown').addEventListener('click', () => this.host.dropdownAction = false); but I do not like this solution...

RFMV34 avatar Aug 24 '21 10:08 RFMV34

Hi @RFMV34 ! This is the way it's supposed to happen, not sure why it isn't for you. When you implement the FateDropdown interface you have to have a valueChange event emitter. When the user picks the user in your dropdown, the dropdown component should emit the value for the user and it turn this will trigger the registered action linked to the component which will close the dropdown.

If you look at https://github.com/onaluf/fate/blob/6eb62195bb85b8610b09e560eaed2b8d28aa04ec/src/app/example-mention-dropdown/example-mention-dropdown.component.ts that's more or less what's going on.

If that didn't help you find the problem don't hesitate to give an example of a dropdown that cause this issue and I'll work on it !

onaluf avatar Aug 30 '21 15:08 onaluf

Hi @RFMV34 ! This is the way it's supposed to happen, not sure why it isn't for you. When you implement the FateDropdown interface you have to have a valueChange event emitter. When the user picks the user in your dropdown, the dropdown component should emit the value for the user and it turn this will trigger the registered action linked to the component which will close the dropdown.

If you look at https://github.com/onaluf/fate/blob/6eb62195bb85b8610b09e560eaed2b8d28aa04ec/src/app/example-mention-dropdown/example-mention-dropdown.component.ts that's more or less what's going on.

If that didn't help you find the problem don't hesitate to give an example of a dropdown that cause this issue and I'll work on it !

I tried your example component, but after mention is picked, popover is not closed, so I open pull request with this functionality. btw RFMV34 is my corporate profile...

Raiper34 avatar Sep 19 '21 15:09 Raiper34

That is very weird... which browser are you using? Would you be able to share a example of it failing?

I'm ready to accept your pull request but I would like to understand why it's not working for you first!

onaluf avatar Sep 20 '21 15:09 onaluf

That is very weird... which browser are you using? Would you be able to share a example of it failing?

I'm ready to accept your pull request but I would like to understand why it's not working for you first!

Hi, I made example on Stackblitz using your example mention dropdown component. https://stackblitz.com/edit/angular-c4peuv?file=src/app/example-mention-dropdown/example-mention-dropdown.component.ts After I pick mention, dropdown keeps opened for me. I am using Chrome Version 93.0.4577.82 (Official Build) (64-bit)

RFMV34 avatar Sep 22 '21 11:09 RFMV34