Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to close dropdown #91

Open
RFMV34 opened this issue Aug 24, 2021 · 5 comments · May be fixed by #92
Open

How to close dropdown #91

RFMV34 opened this issue Aug 24, 2021 · 5 comments · May be fixed by #92
Assignees

Comments

@RFMV34
Copy link

RFMV34 commented Aug 24, 2021

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
Copy link
Author

RFMV34 commented Aug 24, 2021

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...

@onaluf
Copy link
Owner

onaluf commented Aug 30, 2021

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 onaluf self-assigned this Aug 30, 2021
@Raiper34 Raiper34 linked a pull request Aug 30, 2021 that will close this issue
@Raiper34
Copy link

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...

@onaluf
Copy link
Owner

onaluf commented Sep 20, 2021

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!

@RFMV34
Copy link
Author

RFMV34 commented Sep 22, 2021

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants