fix(members): prevent MemberSidebar from closing when clicking outside while UserProfilePopover is open
All checks were successful
Deploy Waveform to VPS / deploy (push) Successful in 56s

This commit is contained in:
Chneemann 2026-09-11 09:01:26 +02:00
parent ba8bcd6116
commit a6232b0c38
No known key found for this signature in database
2 changed files with 4 additions and 5 deletions

View file

@ -47,6 +47,7 @@ export function MemberSidebar() {
const [members, setMembers] = useState<User[]>([]); const [members, setMembers] = useState<User[]>([]);
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
/** Fetches members for the active server and manages loading states. */
useEffect(() => { useEffect(() => {
if (!activeServer?.id) { if (!activeServer?.id) {
setMembers([]); setMembers([]);
@ -82,15 +83,12 @@ export function MemberSidebar() {
}; };
}, [activeServer?.id]); }, [activeServer?.id]);
/** Closes the members sidebar when clicking outside of it */
useEffect(() => { useEffect(() => {
function handleClickOutside(event: MouseEvent) { function handleClickOutside(event: MouseEvent) {
const target = event.target as HTMLElement; const target = event.target as HTMLElement;
if ( if (document.querySelector("[data-user-profile-popover]") !== null) {
target.closest('button[title*="Mitgliederliste"]') ||
target.closest('[role="dialog"]') ||
target.closest(".user-profile-popover")
) {
return; return;
} }

View file

@ -85,6 +85,7 @@ export function UserProfilePopover({
return ( return (
<div <div
data-user-profile-popover
ref={popoverRef} ref={popoverRef}
style={{ style={{
position: "fixed", position: "fixed",