Open
Description
Summary:
ReactModal does not correctly handle case when bodyOpenClassName
is null
Steps to reproduce:
- render a with prop bodyOpenClassName={null}
- cause it to no longer render, forcing it to unmount
- see console error, in
ModalPortal:afterClose()
->classList.js:remove()
:Uncaught TypeError: Cannot read property 'split' of null
Example:
https://codepen.io/benjiwheeler/pen/aRJzOY?editors=1111
To see the problem in this Codepen:
- open browser js console
- after codepen execution pane reloads, click "Trigger the modal"
- see the console error
- clear the console output
- remove the
bodyOpenClassName={null}
from the js code on the top right - after codepen execution pane reloads, click "Trigger the modal"
- observe that there is no error and the modal is fine!
Expected behavior:
ReactModal should either strictly require a non-null bodyOpenClassName
, or render without applying any bodyOpenClassName
. It should not assume a non-null bodyOpenClassName
exists.
Metadata
Metadata
Assignees
Labels
No labels