I have a scenario that causes el instanceof HTMLElement to always return false
If a new window is opened with window.open, mount the component to the child window button using ReactDOM.createPortal
react will use the document.createElement of the child window to create these DOM elements
This results in the DOM not being part of the main window, and when I get the DOM elements in my code and execute el instanceof HTMLElement, it always returns false, so I can't get the scroll elements
I have a scenario that causes el instanceof HTMLElement to always return false
If a new window is opened with window.open, mount the component to the child window button using ReactDOM.createPortal react will use the document.createElement of the child window to create these DOM elements
This results in the DOM not being part of the main window, and when I get the DOM elements in my code and execute el instanceof HTMLElement, it always returns false, so I can't get the scroll elements
Here I provide the demo https://stackblitz.com/edit/react-pk98uy?file=src%2FApp.js,src%2Findex.js, which you can click in order: open win -> react create portal -> check element console.log will print false