Respect Node.ownerDocument of anchorEl when creating portal for Menu
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
When opening a Menu and creating a react portal, the portal that’s created should reference the Node.ownerDocument
of the anchorEl
or something similar, to support rendering Material-UI components in a new window (such as through a library like react-popout)
Current Behavior
The portal that is created always uses the global document
object to append a portal div to. See: https://github.com/callemall/material-ui/blob/08fae8c2fcd741c01cabbee38305d5ef109acfd5/src/internal/Portal.js#L45-L55
Steps to Reproduce (for bugs)
A simple example can be seen here: https://codesandbox.io/s/v09qklqkj7. You can ignore the lack of styling and what not in the popout window, just trying to show the portal issue.
Your Environment
Tech | Version |
---|---|
Material-UI | 1.0.0-beta.21 |
React | 16 |
browser | All |
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
Respect Node.ownerDocument of anchorEl when creating ...
Material UI Portal renders into the top-level body. We were able to first the first issue by configuring JSS's insertion point to use...
Read more >@mui/icons-material | Yarn - Package Manager
This package provides the Google Material Icons converted to SvgIcon components. Installation. Install the package in your project directory with: // with npm...
Read more >Incident Response - Hybrid Analysis
Submit malware for free analysis with Falcon Sandbox and Hybrid Analysis technology. Hybrid Analysis develops and licenses analysis tools to fight malware.
Read more >CHANGELOG.md · Gitee 极速下载/Material-UI - Gitee.com
... [core] Create shared Next.js baseline config (#34259) @oliviertassinari; [core] In typescript-to-proptypes , respect the value pass to ...
Read more >UDN Search
... syntax js::value js::falsevalue() description js::falsevalue creates a js::value that represents the javascript value false. ... see also mxr id search for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I also ran into this same problem recently. Our project is a Chrome extension, and we render our UI inside of an
iframe
on the page to avoid inheriting that page’s styles, which as you could imagine, breaks the styles added by Material UI in wonderful amazing ways.This introduced two problems:
We were able to first the first issue by configuring JSS’s insertion point to use the
iframe
’s document, but the second issue is exactly what you are addressing with this PR.I agree that rendering Material UI components into an
iframe
is an edge-case, but I don’t think it should be completely discounted either, as it provides a lot of power when building applications more complicated than a single page application.Problem solved too 😃