diff --git a/components/layout/MemberSidebar.tsx b/components/layout/MemberSidebar.tsx index 7c4e4f3..65fc26c 100644 --- a/components/layout/MemberSidebar.tsx +++ b/components/layout/MemberSidebar.tsx @@ -47,6 +47,7 @@ export function MemberSidebar() { const [members, setMembers] = useState([]); const [isLoading, setIsLoading] = useState(false); + /** Fetches members for the active server and manages loading states. */ useEffect(() => { if (!activeServer?.id) { setMembers([]); @@ -82,15 +83,12 @@ export function MemberSidebar() { }; }, [activeServer?.id]); + /** Closes the members sidebar when clicking outside of it */ useEffect(() => { function handleClickOutside(event: MouseEvent) { const target = event.target as HTMLElement; - if ( - target.closest('button[title*="Mitgliederliste"]') || - target.closest('[role="dialog"]') || - target.closest(".user-profile-popover") - ) { + if (document.querySelector("[data-user-profile-popover]") !== null) { return; } diff --git a/components/ui/UserProfilePopover.tsx b/components/ui/UserProfilePopover.tsx index e7ebb77..8c44ece 100644 --- a/components/ui/UserProfilePopover.tsx +++ b/components/ui/UserProfilePopover.tsx @@ -85,6 +85,7 @@ export function UserProfilePopover({ return (