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

Unable to close the dropdown after double selection #715

Open
Uni2K opened this issue Jul 27, 2023 · 5 comments
Open

Unable to close the dropdown after double selection #715

Uni2K opened this issue Jul 27, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@Uni2K
Copy link

Uni2K commented Jul 27, 2023

Describe the bug
When using a custom ItemRenderer, double selecting a single item will remove the capability to close the dropdown when clicking outside.

Sandbox / Git Repo
https://codesandbox.io/s/naughty-dewdney-wn7v74?file=/src/App.js

To Reproduce
Steps to reproduce the behavior:

  1. Check out the repo
  2. Select a single item
  3. Deselect the item
  4. click outside of the dropdown
  5. It won't close

Expected behavior
It closes when clicked outside

Screenshots
closing

Desktop (please complete the following information):

  • OS: Win 11
  • Chrome
  • Latest

Additional context
Maybe I use the Default Item renderer wrong, but there is no working example in the docs and this was the only thing I found in the soruce code.

@Uni2K Uni2K added the bug Something isn't working label Jul 27, 2023
@PhucNguyenHDW
Copy link

Hi, I have the same issue. Any update on this one?

@PhucNguyenHDW
Copy link

Hi @Souravvmishra
If we use the default list, it will work as expected.
Bug case is When using a custom ItemRenderer

@PhucNguyenHDW
Copy link

I work around this by using the useClickAway hook in @uidotdev/usehooks
Put the MultiSelect component in div with ref from useClickAway
When clicked outside, trigger function to find to class .dropdown-heading, then trigger click event.
Worked!

@gauthamdas
Copy link

@Uni2K Please check the focus of the dropdown. When you use a ItemRender after first click, the Dropdown loses focus and cannot be closed clicking outside.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants