diff --git a/app/soapbox/features/ui/components/media_modal.js b/app/soapbox/features/ui/components/media_modal.js index 9ae762586..c6d07db6a 100644 --- a/app/soapbox/features/ui/components/media_modal.js +++ b/app/soapbox/features/ui/components/media_modal.js @@ -119,6 +119,13 @@ class MediaModal extends ImmutablePureComponent { } } + handleCloserClick = e => { + const activeSlide = document.querySelector('.media-modal .react-swipeable-view-container > div[aria-hidden="false"]'); + if (e.target === activeSlide || !activeSlide.contains(e.target)) { + this.props.onClose(); + } + } + render() { const { media, status, account, intl, onClose } = this.props; const { navigationHidden } = this.state; @@ -236,7 +243,7 @@ class MediaModal extends ImmutablePureComponent {