clauderic / clauderic/react-sortable-hoc

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

Open
#863 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10.9k
Forks
959
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.