Skip to content

Commit d8051f9

Browse files
committed
[chore] improve documentation for shouldCloseOnOverlayClick.
closes #620.
1 parent 9012d81 commit d8051f9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Using shouldCloseOnOverlayClick
22

3-
This example shows using `shouldCloseOnOverlayClick` set to `false` so that closing by clicking on the overlay doesn't work.
3+
When `shouldCloseOnOverlayClick` is `true` (default value for this property),
4+
it requires the `onRequestClose` to be defined in order to close the <Modal/>.
5+
This is due to the fact that the `react-modal` doesn't store the `isOpen`
6+
on its state (only for the internal `portal` (see [ModalPortal.js](https://github.com/reactjs/react-modal/blob/master/src/components/ModalPortal.js)).
47

5-
`shouldCloseOnOverlayClick` requires `onRequestClose` in order to close the <Modal/> because `react-modal` does not store `isOpen` in its local state.
6-
7-
[](codepen://claydiffrient/woLzwo)
8+
[disable 'close on overlay click', codepen by claydiffrient](codepen://claydiffrient/woLzwo)
9+
[enable 'close on overlay click', codepen by sbgriffi](codepen://sbgriffi/WMyBaR)

0 commit comments

Comments
 (0)