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
All checks were successful
Deploy Waveform to VPS / deploy (push) Successful in 56s
This commit is contained in:
parent
ba8bcd6116
commit
a6232b0c38
2 changed files with 4 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ export function UserProfilePopover({
|
|||
|
||||
return (
|
||||
<div
|
||||
data-user-profile-popover
|
||||
ref={popoverRef}
|
||||
style={{
|
||||
position: "fixed",
|
||||
|
|
|
|||
Loading…
Reference in a new issue