From 7f156cc7211150e3e4ccc370367571febde811cd Mon Sep 17 00:00:00 2001 From: BOHA Date: Sat, 6 Jun 2026 14:34:48 +0200 Subject: [PATCH] fix(modals): ConfirmModal locks body scroll + respects loading on backdrop ConfirmModal never called useModalLock, so the page scrolled behind every confirmation dialog (8+ usages). Add the ref-counted scroll lock and guard backdrop-click against the loading state, matching FormModal. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/admin/components/ConfirmModal.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/admin/components/ConfirmModal.tsx b/src/admin/components/ConfirmModal.tsx index fb4f692..166e62a 100644 --- a/src/admin/components/ConfirmModal.tsx +++ b/src/admin/components/ConfirmModal.tsx @@ -1,6 +1,7 @@ import { useEffect, type ReactNode } from "react"; import { motion, AnimatePresence } from "framer-motion"; import useReducedMotion from "../hooks/useReducedMotion"; +import useModalLock from "../hooks/useModalLock"; interface ConfirmModalProps { isOpen: boolean; @@ -93,6 +94,8 @@ export default function ConfirmModal({ loading, }: ConfirmModalProps) { const reducedMotion = useReducedMotion(); + // Lock body scroll while open (ref-counted, nesting-safe) — matches FormModal. + useModalLock(isOpen); useEffect(() => { if (!isOpen) return; @@ -119,7 +122,10 @@ export default function ConfirmModal({ exit={{ opacity: 0 }} transition={{ duration: reducedMotion ? 0 : 0.18 }} > -
+
!loading && onClose()} + />