diff --git a/examples/basic/simple_usage/index.js b/examples/basic/simple_usage/index.js
index c675927f..4ab6676d 100644
--- a/examples/basic/simple_usage/index.js
+++ b/examples/basic/simple_usage/index.js
@@ -76,6 +76,7 @@ class SimpleUsage extends Component {
closeTimeoutMS={150}
contentLabel="modalB"
isOpen={currentModal == MODAL_B}
+ shouldCloseOnOverlayClick={false}
onAfterOpen={this.handleOnAfterOpenModal}
onRequestClose={this.toggleModal(MODAL_B)}>
this.heading = h1}>This is the modal 2!
diff --git a/src/components/ModalPortal.js b/src/components/ModalPortal.js
index 823d3681..bf5d25f5 100644
--- a/src/components/ModalPortal.js
+++ b/src/components/ModalPortal.js
@@ -242,7 +242,10 @@ export default class ModalPortal extends Component {
this.shouldClose = false;
};
- handleOverlayOnMouseDown = () => {
+ handleOverlayOnMouseDown = event => {
+ if (!this.props.shouldCloseOnOverlayClick) {
+ event.preventDefault();
+ }
this.moveFromContentToOverlay = false;
};