DEV Community

Discussion on: Using usePopper and styled-components to create a practical dropdown from scratch

Collapse
 
palashkaria profile image
Palash Karia

In the last example here, the popover closes even when an item inside the menu is clicked

You might want to use a useOutsideClick hook maybe? usehooks.com/useOnClickOutside/

Collapse
 
tannerhallman profile image
Tanner Hallman

That is the expected behavior of a dropdown component in my experience and the direction I was headed with this example. It is definitely a nice feature if you're looking to persist the visibility of the dropdown menu outside clicks. Thanks for the link!