From fe1983bda8fabe2cf6f36bc021aee9ac4e6e8dc5 Mon Sep 17 00:00:00 2001 From: Timofey Smirnov Date: Thu, 10 Aug 2017 16:57:43 +0300 Subject: [PATCH] fix #466: Dragging inside modal and release outside of modal closes the modal --- src/components/ModalPortal.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/ModalPortal.js b/src/components/ModalPortal.js index 61086122..fc3ac193 100644 --- a/src/components/ModalPortal.js +++ b/src/components/ModalPortal.js @@ -221,6 +221,10 @@ export default class ModalPortal extends Component { this.shouldClose = false; } + handleCountenOnMouseDown = () => { + this.shouldClose = false; + } + requestClose = event => this.ownerHandlesClose() && this.props.onRequestClose(event); @@ -273,6 +277,7 @@ export default class ModalPortal extends Component { className={this.buildClassName('content', className)} tabIndex="-1" onKeyDown={this.handleKeyDown} + onMouseDown={this.handleCountenOnMouseDown} onClick={this.handleContentOnClick} role={this.props.role} aria-label={this.props.contentLabel}