Fix media modal unable to close from image
This commit is contained in:
parent
bca6852b94
commit
8cd0f594a0
1 changed files with 7 additions and 2 deletions
|
@ -119,9 +119,14 @@ class MediaModal extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCloserClick = e => {
|
handleCloserClick = ({ target }) => {
|
||||||
|
const whitelist = ['zoomable-image'];
|
||||||
const activeSlide = document.querySelector('.media-modal .react-swipeable-view-container > div[aria-hidden="false"]');
|
const activeSlide = document.querySelector('.media-modal .react-swipeable-view-container > div[aria-hidden="false"]');
|
||||||
if (e.target === activeSlide || !activeSlide.contains(e.target)) {
|
|
||||||
|
const isClickOutside = target === activeSlide || !activeSlide.contains(target);
|
||||||
|
const isWhitelisted = whitelist.some(w => target.classList.contains(w));
|
||||||
|
|
||||||
|
if (isClickOutside || isWhitelisted) {
|
||||||
this.props.onClose();
|
this.props.onClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue