diff --git a/web/modals/modal-overlay.css b/web/modals/modal-overlay.css index 89037f396..2e97c89d1 100644 --- a/web/modals/modal-overlay.css +++ b/web/modals/modal-overlay.css @@ -1,13 +1,13 @@ div.modalOverlay { position: fixed; left: 0; top: 0; height: 100%; z-index: 4; width: 100%; - background-color: rgba(0, 0, 0, 0.9); + background-color: #000000e6; display: flex; flex-direction: column; align-items: center; justify-content: center; } diff --git a/web/modals/modal-overlay.react.js b/web/modals/modal-overlay.react.js index dbccb2fc9..78be45769 100644 --- a/web/modals/modal-overlay.react.js +++ b/web/modals/modal-overlay.react.js @@ -1,63 +1,63 @@ // @flow import * as React from 'react'; import css from './modal-overlay.css'; type ModalOverlayProps = { +onClose: () => void, +children?: React.Node, }; function ModalOverlay(props: ModalOverlayProps): React.Node { const { children, onClose } = props; const overlayRef = React.useRef(); const firstClickRef = React.useRef(null); + React.useLayoutEffect(() => { + if (overlayRef.current) { + overlayRef.current.focus(); + } + }, []); + const onBackgroundMouseDown = React.useCallback(event => { firstClickRef.current = event.target; }, []); const onBackgroundMouseUp = React.useCallback( event => { if ( event.target === overlayRef.current && firstClickRef.current === overlayRef.current ) { onClose(); } }, [onClose], ); const onKeyDown = React.useCallback( event => { if (event.keyCode === 27) { onClose(); } }, [onClose], ); - React.useEffect(() => { - if (overlayRef.current) { - overlayRef.current.focus(); - } - }, []); - return (