diff --git a/components/Modal.js b/components/Modal.js index 76d0531a9f2f..c3f2873b07a9 100644 --- a/components/Modal.js +++ b/components/Modal.js @@ -1,41 +1,57 @@ -import { useEffect, useRef } from 'react' +import { useEffect, useRef } from 'react'; -export default function Modal({ - title, - children, - onModalClose = () => {}, -}) { - const modalRef = useRef(null) +export default function Modal({ title, children, onModalClose = () => {} }) { + const modalRef = useRef(null); useEffect(() => { - modalRef.current.focus() - }, []) + modalRef.current.focus(); + }, []); function backdropClickHandler(e) { - if (modalRef.current && (modalRef.current === e.target || !modalRef.current.contains(e.target))) { - onModalClose() + if ( + modalRef.current && + (modalRef.current === e.target || !modalRef.current.contains(e.target)) + ) { + onModalClose(); } } function onKeyUpHandler(e) { - if (e.key === 'Escape') onModalClose() + if (e.key === 'Escape') onModalClose(); } - + return ( -