From c6a6c99efe696e8a31792d85b7533a0722dd37f0 Mon Sep 17 00:00:00 2001 From: abias Date: Tue, 13 Jun 2023 22:34:06 -0400 Subject: [PATCH] Fix dropdown bug --- src/shared/components/app/navbar.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/shared/components/app/navbar.tsx b/src/shared/components/app/navbar.tsx index ce62811a..bdbac9ff 100644 --- a/src/shared/components/app/navbar.tsx +++ b/src/shared/components/app/navbar.tsx @@ -34,7 +34,9 @@ interface NavbarState { } function handleCollapseClick(i: Navbar) { - i.collapseButtonRef.current?.click(); + if (i.collapseButtonRef.current?.ariaExpanded === "true") { + i.collapseButtonRef.current?.click(); + } } function handleLogOut(i: Navbar) { @@ -65,12 +67,12 @@ export class Navbar extends Component { await this.fetchUnreads(); this.requestNotificationPermission(); - document.addEventListener("click", this.handleOutsideMenuClick); + document.addEventListener("mouseup", this.handleOutsideMenuClick); } } componentWillUnmount() { - document.removeEventListener("click", this.handleOutsideMenuClick); + document.removeEventListener("mouseup", this.handleOutsideMenuClick); } render() {