alex-cory/react-useportal

Open a modal on another modal

Opened this issue · 0 comments

I'm trying to open a modal on another modal using react-useportal. I manage to make it happen, but I'm getting the following error when I am trying to close or click the second modal.

TypeError: Cannot read properties of undefined (reading 'contains')
    at containsTarget (usePortal.js?4dd6:114:50)
    at eval (usePortal.js?4dd6:115:1)
    at HTMLDocument.eval (usePortal.js?4dd6:126:1)
    at HTMLDocument.__trace__ (bugsnag.js?d359:2764:1)

Also when I check the relevant line on the usePortal.js file, I found the below line.
var containsTarget = function (target) { return target.current.contains(e.target); };

How can I fix this error or, is there any proper way to open a modal on another modal using react-useportal. Any kind of help is highly appreciated 🙏