react-component / util

Common Utils For React Component
util.vercel.app
MIT License
623 stars 178 forks source link

isVisible failing with element from a different window #436

Open cpind opened 1 year ago

cpind commented 1 year ago

Hey,

I wanted to report a small issue with isVisible function.

I'm working on an application that opens new windows to show some components. We rely on react component for tooltips and popup and we realized that they are failing on those components that run on the new windows. After some investigation we realised that the issue came from the isVisible function that fails when the element comes from another window.

The problem comes from the element instanceof Element that always fails because the `Element' class instance is window dependant.

There is a fix for which is to rely on element.ownerDocument.defaultView.Element instead.

Would accept a PR for this issue?

Best,