diff --git a/app/javascript/mastodon/components/modal_root.jsx b/app/javascript/mastodon/components/modal_root.jsx index c1c2e9b068e..90267bff681 100644 --- a/app/javascript/mastodon/components/modal_root.jsx +++ b/app/javascript/mastodon/components/modal_root.jsx @@ -61,9 +61,11 @@ class ModalRoot extends PureComponent { handleBackgroundClick = (e) => { // Close modal, but only when clicking outside of the modal's content - if (!e.target.matches('.modal-root__container *')) { - this.props.onClose(); + if (e.target.matches('.modal-root__container *') || !e.target.matches('.modal-root *')) { + return; } + + this.props.onClose(); } componentDidMount () {