diff --git a/types/react-modal/index.d.ts b/types/react-modal/index.d.ts index f60d586c74..66d24a87e6 100644 --- a/types/react-modal/index.d.ts +++ b/types/react-modal/index.d.ts @@ -126,4 +126,9 @@ declare class ReactModal extends React.Component { * and other assistive technologies while the modal is open. */ static setAppElement(appElement: string | HTMLElement): void; + + portal: { + overlay: Element | undefined; + content: HTMLDivElement; + }; } diff --git a/types/react-modal/react-modal-tests.tsx b/types/react-modal/react-modal-tests.tsx index 96f7c84678..714a20e4ef 100644 --- a/types/react-modal/react-modal-tests.tsx +++ b/types/react-modal/react-modal-tests.tsx @@ -82,3 +82,13 @@ class ExampleOfUsingReactModal extends React.Component { ); } } + +const MyWrapperComponent: React.FC = () => { + const reactModaRef = React.useRef(); + + React.useLayoutEffect(() => { + reactModaRef.current.portal.content.focus(); + }); + + return Hello, World!; +};