diff --git a/apps/renderer/src/components/ui/modal/stacked/modal.tsx b/apps/renderer/src/components/ui/modal/stacked/modal.tsx index 1aabbfe51..0e34f2736 100644 --- a/apps/renderer/src/components/ui/modal/stacked/modal.tsx +++ b/apps/renderer/src/components/ui/modal/stacked/modal.tsx @@ -24,7 +24,6 @@ import { AppErrorBoundary } from "~/components/common/AppErrorBoundary" import { SafeFragment } from "~/components/common/Fragment" import { m } from "~/components/common/Motion" import { ErrorComponentType } from "~/components/errors/enum" -import { resizableOnly } from "~/components/ui/modal" import { ElECTRON_CUSTOM_TITLEBAR_HEIGHT, isElectronBuild } from "~/constants" import { useSwitchHotKeyScope } from "~/hooks/common" import { nextFrame, stopPropagation } from "~/lib/dom" @@ -52,10 +51,14 @@ export const ModalInternal = memo( index: number isTop: boolean + isBottom: boolean overlayOptions?: ModalOverlayOptions onClose?: (open: boolean) => void } & PropsWithChildren - >(function Modal({ item, overlayOptions, onClose: onPropsClose, children, isTop }, ref) { + >(function Modal( + { item, overlayOptions, onClose: onPropsClose, children, isTop, isBottom }, + ref, + ) { const { CustomModalComponent, modalClassName, @@ -273,7 +276,7 @@ export const ModalInternal = memo( ) @@ -371,7 +374,7 @@ export const ModalInternal = memo( }} > { const topModalIndex = stack.findLastIndex((item) => item.modal) const overlayIndex = stack.findLastIndex((item) => item.overlay || item.modal) const overlayOptions = stack[overlayIndex]?.overlayOptions + + const hasModalStack = stack.length > 0 + + useEffect(() => { + // NOTE: document.body is being used by radix's dismissable, + // and using that will cause radix to get the value of `none` as the store value, + // and then revert to `none` instead of `auto` after a modal dismiss. + document.documentElement.style.pointerEvents = hasModalStack ? "none" : "auto" + document.documentElement.dataset.hasModal = hasModalStack.toString() + }, [hasModalStack]) return ( {stack.map((item, index) => ( ))}