You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not 100% sure that it's a bad idea, but according to react documentation on ReactDOM.render :
ReactDOM.render() controls the contents of the container node you pass in. Any existing DOM elements inside are replaced when first called. Later calls use React’s DOM diffing algorithm for efficient updates.
It is unneccessary and unreliable to create an extra div to hold Portal. The
presumed benefits[1] of an extra div are never proven and developers never
find an *ACTUAL* case where putting Portal to the body poses a problem[2].
In our case, creation of this extra div (or the logics to do so) is the
*ACTUAL* problem. Somehow the "ref" inside this div doesn't work reliably.
As a result, getIdealLocation and handleMouseEnter fail.
[1]: https://stackoverflow.com/questions/49504546/is-it-safe-to-use-reactdom-createportal-with-document-body
[2]: mui/material-ui#21626
Bug: #15
https://github.com/mui-org/material-ui/blob/c9e218142e98f4bef2ec31852bdcc0a3290f3742/packages/material-ui/src/Portal/Portal.js#L27
I'm not 100% sure that it's a bad idea, but according to react documentation on
ReactDOM.render
:And this stackorverflow post
Are you sure it's safe ? Wouldn't it be better/safer to just create a div in the body instead or throw an error ?
The text was updated successfully, but these errors were encountered: