diff --git a/src/components/common/CharacterList.tsx b/src/components/common/CharacterList.tsx index d8f6bccf..e1a477f5 100644 --- a/src/components/common/CharacterList.tsx +++ b/src/components/common/CharacterList.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "next-i18next" -import React, { useRef } from "react" +import React, { useCallback, useState } from "react" import { Virtuoso } from "react-virtuoso" import { Modal } from "~/components/ui/Modal" @@ -24,7 +24,13 @@ export const CharacterList: React.FC<{ [] as any[], ) as any[] - const $modalEl = useRef(null) + const [modal, setModal] = useState() + + const modalEl = useCallback((node: HTMLDivElement) => { + if (node !== null) { + setModal(node) + } + }, []) return ( {list?.length ? ( - + , ) => ( ( setOpen(false)} - className={clsx("relative", zIndex ? `z-${zIndex}` : "z-50")} + className={clsx("relative", zIndex ? `z-${zIndex}` : "z-10")} > {/* The backdrop, rendered as a fixed sibling to the panel container */}