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

getScrollingParent's "el instanceof HTMLElement" logic will cause some problems #863

Open
karmiy opened this issue Nov 28, 2022 · 0 comments

Comments

@karmiy
Copy link

karmiy commented Nov 28, 2022

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

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

1 participant