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

[BUG] #531

Closed
isumix opened this issue Mar 7, 2024 · 0 comments · Fixed by #552 · May be fixed by EchoSkorJjj/UI#255
Closed

[BUG] #531

isumix opened this issue Mar 7, 2024 · 0 comments · Fixed by #552 · May be fixed by EchoSkorJjj/UI#255
Labels
bug Something isn't working

Comments

@isumix
Copy link

isumix commented Mar 7, 2024

Describe the bug

useOnClickOutside not calls handler when one of the references are not assigned.

To Reproduce

useOnClickOutside({current: false}, () => console.log('close'))

Expected behavior

It should call handler as it effectively clicked outside non existent target.

Additional context

For example I have a popup dialog and a menu within this dialog. useOnClickOutside([dialog, menu], closeDialog). If menu not opened, hence menu.current = null, then closeDialod will never fire.

@isumix isumix added the bug Something isn't working label Mar 7, 2024
juliencrn added a commit that referenced this issue Mar 21, 2024
juliencrn added a commit that referenced this issue Mar 21, 2024
juliencrn added a commit that referenced this issue Mar 21, 2024
* Support missing refs (fixes #531)

* Add support for focus event to `useOnClickOutside` (Fixes: #522)

* Expose `AddEventListenerOptions` in `useOnClickOutside` (Fixes #554 from @metav-drimz)
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
1 participant