From 0fe11828c99083dcb71da0a5b0b6246828067085 Mon Sep 17 00:00:00 2001 From: Olaf Sulich Date: Wed, 30 Oct 2024 07:28:17 +0100 Subject: [PATCH] refactor(PrimaryModalShell): focus container with ref, get rid of useEffect --- .../PrimaryModalShell/PrimaryModalShell.tsx | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/script/components/Modals/PrimaryModal/PrimaryModalShell/PrimaryModalShell.tsx b/src/script/components/Modals/PrimaryModal/PrimaryModalShell/PrimaryModalShell.tsx index 32021c1c08e..777b370ff91 100644 --- a/src/script/components/Modals/PrimaryModal/PrimaryModalShell/PrimaryModalShell.tsx +++ b/src/script/components/Modals/PrimaryModal/PrimaryModalShell/PrimaryModalShell.tsx @@ -17,7 +17,7 @@ * */ -import {useRef, useEffect, ReactNode} from 'react'; +import {ReactNode} from 'react'; import {ModalComponent} from 'Components/ModalComponent'; @@ -38,14 +38,6 @@ export const PrimaryModalShell = ({ onClose, onBgClick, }: PrimaryModalShellProps) => { - const modalRef = useRef(null); - - useEffect(() => { - if (isShown) { - modalRef.current?.focus(); - } - }, [isShown]); - return (
isShown && ref?.focus()} > {isShown && children}