From d8051f91112f1ec6fa26d8dab8d99daa4edde969 Mon Sep 17 00:00:00 2001 From: Bruno Dias Date: Fri, 23 Feb 2018 11:13:18 -0300 Subject: [PATCH] [chore] improve documentation for shouldCloseOnOverlayClick. closes #620. --- docs/examples/should_close_on_overlay_click.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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)