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 [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;
}

View file

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