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

useClickAway works wrong #2321

Open
narasimhajupally opened this issue Sep 12, 2023 · 6 comments · May be fixed by #2530
Open

useClickAway works wrong #2321

narasimhajupally opened this issue Sep 12, 2023 · 6 comments · May be fixed by #2530
Assignees
Labels
bug Something isn't working

Comments

@narasimhajupally
Copy link

The reproduction link is below

https://codesandbox.io/s/useclickaway-bug-vmhrz7

Possible solution:
use event.currentTarget instead of event.target in the implementation of hook

@liuyib liuyib added the bug Something isn't working label Sep 13, 2023
@liuyib liuyib self-assigned this Sep 13, 2023
@liuyib
Copy link
Collaborator

liuyib commented Sep 13, 2023

It's a bug, thank you for your feedback.

@dxsun97

This comment was marked as resolved.

@narasimhajupally

This comment was marked as resolved.

@dxsun97

This comment was marked as resolved.

@narasimhajupally
Copy link
Author

hey @liuyib , what do you think about the below method

event.composedPath().includes(clickawayInputRef.current)

it will work even if the children which are clicked are removed from dom because of business logic.

@liuyib
Copy link
Collaborator

liuyib commented Oct 17, 2023

hey @liuyib , what do you think about the below method

event.composedPath().includes(clickawayInputRef.current)

it will work even if the children which are clicked are removed from dom because of business logic.

I think that it would be better to add a parameter to control this behavior.

Maybe someone need:

it will work even if the children which are clicked are removed from dom because of business logic.

Maybe also someone need the opposite action.

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
3 participants