diff --git a/docs/examples/should_close_on_overlay_click.md b/docs/examples/should_close_on_overlay_click.md index 096fecb8..b120104e 100644 --- a/docs/examples/should_close_on_overlay_click.md +++ b/docs/examples/should_close_on_overlay_click.md @@ -1,7 +1,9 @@ # Using shouldCloseOnOverlayClick -This example shows using `shouldCloseOnOverlayClick` set to `false` so that closing by clicking on the overlay doesn't work. +When `shouldCloseOnOverlayClick` is `true` (default value for this property), +it requires the `onRequestClose` to be defined in order to close the . +This is due to the fact that the `react-modal` doesn't store the `isOpen` +on its state (only for the internal `portal` (see [ModalPortal.js](https://github.com/reactjs/react-modal/blob/master/src/components/ModalPortal.js)). -`shouldCloseOnOverlayClick` requires `onRequestClose` in order to close the because `react-modal` does not store `isOpen` in its local state. - -[](codepen://claydiffrient/woLzwo) +[disable 'close on overlay click', codepen by claydiffrient](codepen://claydiffrient/woLzwo) +[enable 'close on overlay click', codepen by sbgriffi](codepen://sbgriffi/WMyBaR)