Skip to content

fix(@toss/react): useOutsideClickEffect is called twice on touch event #451

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

Merged

Conversation

saul-atomrigs
Copy link
Contributor

Overview

Fixes #354 and #449

I agree with this answer. click event works fine on touchable screen too, so there is no need to have a touch event listener.

I believe another solution might be adding e.preventDefault() for the touch event. According to MDN:

... event.preventDefault() to keep the browser from continuing to process the touch event (this also prevents a mouse event from also being delivered).

However, I think this is a bit more over-engineering... so I decided to go with the first solution.

PR Checklist

  • [✅] I read and included theses actions below
  1. I have read the Contributing Guide
  2. I have written documents and tests, if needed.

Copy link

netlify bot commented Mar 24, 2024

👷 Deploy request for slash-libraries pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit fee8286

Copy link
Collaborator

@raon0211 raon0211 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@raon0211 raon0211 merged commit 08983ce into toss:main May 31, 2024
5 checks passed
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 this pull request may close these issues.

[BUG]: useOutsideClickEffect callback function runs twice in touch event.
2 participants