Skip to content

[docs] Unclear documentation for container prop when using Shadow DOM #48292

@trygve-aaberge-adsk

Description

@trygve-aaberge-adsk

Related page

https://mui.com/material-ui/customization/shadow-dom/

Kind of issue

Unclear explanations

Issue description

The documentation says:

Material UI components like Menu, Dialog, Popover, and others use the Portal component to render a new "subtree" in a container outside of current DOM hierarchy.

However, the example below only sets the container prop for MuiPopover, MuiPopper and MuiModal, not for MuiMenu or MuiDialog. After looking into it, I see that Menu inherits the Popover props and Dialog inherits the Modal props. So presumably setting it for Popover and Modal will make it be used by Menu and Dialog too? However, I can't find documentation stating that the default props are inherited too, and it's not clear that this inheritance exists from the shadow DOM documentation.

This is a bit besides the point for documentation, but it's also a bit inconvenient having to specify the container separately for each component. What if new components are added that also requires setting a container? This could be easy to miss.

Context

Trying to use Material UI inside a shadow DOM element.

Search keywords: shadow dom container

Metadata

Metadata

Assignees

Labels

docsImprovements or additions to the documentation.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions