Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal Error #20

Open
MaiRizk opened this issue Oct 27, 2021 · 1 comment
Open

Modal Error #20

MaiRizk opened this issue Oct 27, 2021 · 1 comment

Comments

@MaiRizk
Copy link

MaiRizk commented Oct 27, 2021

This error is there when I try to showModal using Modal.js
Uncaught TypeError: Cannot read properties of null (reading 'appendChild')
at Modal.js:13

@RaminMammadzada
Copy link

RaminMammadzada commented Nov 25, 2021

The same issue is in my local as well.

UPDATE:
The solution I found is to defend against the possibility of elRef.current being null.
Just add the line to if block:

    if(elRef.current) {
      modalRoot.appendChild(elRef.current);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants