Permalink
Browse files

fix(ZNTA-2133): Also handle clicks outside of modal backdrop

  • Loading branch information...
efloden committed Aug 1, 2017
1 parent 34e6bf4 commit cb7e5b7f891f2daa7d969ed243e8c831e9a800b8
Showing with 5 additions and 2 deletions.
  1. +5 −2 server/zanata-frontend/src/frontend/app/components/Modal/index.jsx
@@ -26,7 +26,9 @@ const Modal = ({
}
const handleClickOutside = (e) => {
const classname = e.target.className
if (classname === 'modal' || classname === 'container') {
const clickedBackdrop = (classname === 'modal' || classname === 'container')
const clickedOutsideComponent = (e.target === e.currentTarget)
if (clickedOutsideComponent || clickedBackdrop) {
onHide()
}
}
@@ -36,8 +38,9 @@ const Modal = ({
onKeyDown={keyboard && handleKeyDown}
containerClassName='has-modal'
className='modal'
onClick={backdrop && handleClickOutside}
>
<div className='container' onClick={backdrop && handleClickOutside}>
<div className='container'>
<div className='modal-content' tabIndex="0">
{closeButton && (
<Button aria-label={closeLabel}

0 comments on commit cb7e5b7

Please sign in to comment.