From da6a22eb46d75298759facf20a596b008ebbb14f Mon Sep 17 00:00:00 2001 From: hiba9201 Date: Sun, 10 Dec 2023 18:59:09 +0500 Subject: [PATCH] move on close to props --- client/components/UI/Modal/Modal.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/client/components/UI/Modal/Modal.tsx b/client/components/UI/Modal/Modal.tsx index 675f2b9f..6975c3a5 100644 --- a/client/components/UI/Modal/Modal.tsx +++ b/client/components/UI/Modal/Modal.tsx @@ -16,10 +16,6 @@ export function Modal({ title = null, children, onClose = () => {} }) { ref.current.showModal(); // Remove focus after open (document.activeElement as HTMLElement).blur(); - - ref.current.addEventListener('close', onClose); - - return () => ref.current?.removeEventListener('close', onClose); }, []); const close = () => { @@ -27,7 +23,7 @@ export function Modal({ title = null, children, onClose = () => {} }) { }; return ( - +