Skip to content

Add click away listener #8

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

chrrrs
Copy link

@chrrrs chrrrs commented May 20, 2020

Depict click away functionality from Facebook

Accurately depict click away functionality from Facebook
const NavItemRef = useRef();

useEffect(() => {
document.addEventListener("click", handleClickOutside, true);
Copy link

Choose a reason for hiding this comment

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

Using the mousedown event instead of click will capture both left and right mouse clicks for anyone in need of that.

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.

2 participants