react-responsive-modal
react-responsive-modal copied to clipboard
Modal does not work with dynamically set `closeOnEsc` prop
Bug report
Describe the bug
I'm working on a modal implementation where, if an error is encountered, the user can no longer exit the modal via clicking on the overlay or by pressing escape. They should instead follow the subsequent instructions shown in the modal. When doing this, I noticed that the closeOnEsc
behaviour wasn't taking effect, whereas closeOnOverlayClick
worked fine with the same prop value of !isError
.
To Reproduce
A minimal repro sandbox can be found here
Expected behaviour
The modal should not be able to close when the closeOnEsc
prop gets dynamically set to false due to a react state update.
System information
- Version of react-responsive-modal:
6.2.0
- Version of react:
18.2.0
- Browser version: all current browsers