From 885a7ccdc1195c1690f7bb14826c556bd79930c1 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 4 Jan 2021 17:43:33 -0300 Subject: [PATCH] A nice focus trap :D --- components/ui/Modal/Modal.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/ui/Modal/Modal.tsx b/components/ui/Modal/Modal.tsx index 34162360b..150ddcdf0 100644 --- a/components/ui/Modal/Modal.tsx +++ b/components/ui/Modal/Modal.tsx @@ -16,12 +16,10 @@ interface Props { onEnter?: () => void | null } -// Todo: Drag focus to component - const Modal: FC = ({ children, open, onClose, onEnter = null }) => { const ref = useRef() as React.MutableRefObject - const handleKey = (e: KeyboardEvent) => { + const handleKey = (e: KeyboardEvent) => { if (e.key === 'Escape') { return onClose() }