-
Notifications
You must be signed in to change notification settings - Fork 99
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
feat: add hook useOnClickOutside #1006
Conversation
Preview is ready. |
9b83c41
to
9d53847
Compare
}; | ||
|
||
window.addEventListener('click', callback, {capture: true}); | ||
window.addEventListener('touchstart', callback, {capture: true}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be touchend
event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on how we decide. I assumed that we need a callback to be triggered as soon as the user touches another place. If you set touchend
, it will work only when the user releases his finger, it may take some time before that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we use click event not mousedown (click happens after mouseup), there should be some consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0442647
to
4380d3c
Compare
4380d3c
to
2e9b118
Compare
}; | ||
|
||
window.addEventListener('mousedown', callback, {capture: true}); | ||
window.addEventListener('touchend', callback, {capture: true}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be consistent here, mousedown and touchstart or mouseup and touchend
3d2f4fa
to
ec50e1a
Compare
No description provided.