Skip to content

Commit 8f74286

Browse files
kyletsangmike-bunce
authored andcommitted
feat(Modal): pass event to onClose
1 parent 33d0635 commit 8f74286

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/Modal/Modal.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ const Modal = ({
4141
const modalRef = useRef(null)
4242
const header = useRef(null)
4343

44-
const handleClose = () => {
44+
const handleClose = (e) => {
4545
if (focusElementAfterClose && focusElementAfterClose.current) {
4646
focusElementAfterClose.current.focus()
4747
}
48-
return onClose()
48+
return onClose(e)
4949
}
5050

5151
const handleKeyDown = e => {
5252
const key = e.keyCode || e.key
5353
if (key === 'Escape' || key === 27) {
54-
return handleClose()
54+
return handleClose(e)
5555
}
5656
return null
5757
}
@@ -69,7 +69,7 @@ const Modal = ({
6969

7070
const handleOutSideClick = e => {
7171
if (!modalRef.current.contains(e.target)) {
72-
handleClose()
72+
handleClose(e)
7373
}
7474
}
7575

0 commit comments

Comments
 (0)