Skip to content

Commit 674af58

Browse files
committed
Adding openOnHover to dependency list
1 parent ceabe53 commit 674af58

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/lib/Dropdown/Dropdown.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ export const Dropdown = ({
3939
useEffect(() => {
4040
if (!openOnHover && id != null && id.length > 0) {
4141
window.addEventListener('click', onClickObserver);
42+
} else {
43+
window.removeEventListener('click', onClickObserver);
4244
}
4345

4446
return () => window.removeEventListener('click', onClickObserver);
45-
}, []);
47+
}, [openOnHover]);
4648

4749
return (
4850
<div

0 commit comments

Comments
 (0)