Fix dropdown bug

This commit is contained in:
abias 2023-06-13 22:34:06 -04:00
parent 7471dc140e
commit c6a6c99efe

View file

@ -34,7 +34,9 @@ interface NavbarState {
} }
function handleCollapseClick(i: Navbar) { function handleCollapseClick(i: Navbar) {
i.collapseButtonRef.current?.click(); if (i.collapseButtonRef.current?.ariaExpanded === "true") {
i.collapseButtonRef.current?.click();
}
} }
function handleLogOut(i: Navbar) { function handleLogOut(i: Navbar) {
@ -65,12 +67,12 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
await this.fetchUnreads(); await this.fetchUnreads();
this.requestNotificationPermission(); this.requestNotificationPermission();
document.addEventListener("click", this.handleOutsideMenuClick); document.addEventListener("mouseup", this.handleOutsideMenuClick);
} }
} }
componentWillUnmount() { componentWillUnmount() {
document.removeEventListener("click", this.handleOutsideMenuClick); document.removeEventListener("mouseup", this.handleOutsideMenuClick);
} }
render() { render() {