Skip to content

After upgrading to @mui/material version 5.16.14, using Shadow DOM the modals, the popovers and the poppers are no longer properly displayed #45601

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

Closed
dimitra-konstantinidou opened this issue Mar 17, 2025 · 8 comments
Assignees
Labels
component: Popover The React component. component: Popper The React component. See <Popup> for the latest version.

Comments

@dimitra-konstantinidou
Copy link

dimitra-konstantinidou commented Mar 17, 2025

Steps to reproduce

Steps:

  1. We followed this example https://v5.mui.com/material-ui/customization/shadow-dom/

https://codesandbox.io/p/devbox/shadow-dom-forked-dlzy94?workspaceId=ws_CsFSAjuCnbjDUNYa1yiQ9x

Current behavior

No response

Expected behavior

No response

Context

No response

Your environment

npx @mui/envinfo
 
  System:
    OS: Windows 11 10.0.26100
  Binaries:
    Node: 20.18.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: Not Found
  Browsers:
    Chrome: Not Found
    Edge: Chromium (133.0.3065.92)
  npmPackages:
    @emotion/react: ^11.5.0 => 11.14.0
    @emotion/styled: ^11.3.0 => 11.14.0
    @mui/core-downloads-tracker:  5.16.14
    @mui/icons-material: ^5.16.14 => 5.16.14
    @mui/material: ^5.16.14 => 5.16.14
    @mui/private-theming:  5.16.14
    @mui/styled-engine:  5.16.14
    @mui/system:  5.16.14
    @mui/types:  7.2.21
    @mui/utils:  5.16.14
    @types/react: ^19.0.0 => 19.0.10
    react: ^19.0.0 => 19.0.0
    react-dom: ^19.0.0 => 19.0.0
    typescript: ^5.7.3 => 5.8.2

Search keywords: Shadow DOM, version 5.16.14, modal, popover, popper

@dimitra-konstantinidou dimitra-konstantinidou added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Mar 17, 2025
@ZeeshanTamboli
Copy link
Member

I don't see anything wrong. The button inside the Shadow DOM isn't affected by the global style defined in index.html.

@ZeeshanTamboli ZeeshanTamboli added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 18, 2025
@dimitra-konstantinidou
Copy link
Author

Hi,

The button is not affected but for instance there are times that the Popper is displayed like this:

Image

I cannot reproduce it steadily but it happens.

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Mar 18, 2025
@zannager zannager added component: Popover The React component. component: Popper The React component. See <Popup> for the latest version. labels Mar 18, 2025
@dimitra-konstantinidou
Copy link
Author

Basically it happens when I include in the Shadow DOM components from a microfrontend. It is as if the container property is document.body even though I have specified in the host application

MuiPopper: {
      defaultProps: {
        container: shadowRootElement,
      },
    },

This used to work before the upgrade of material ui and react 19, so I am not sure what is causing it.

@ZeeshanTamboli
Copy link
Member

Did you upgrade to React 19 along with MUI v5.16.14? Can you provide a reproduction? A minimal reproduction in a GitHub repo would also work.

@ZeeshanTamboli ZeeshanTamboli added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 18, 2025
@dimitra-konstantinidou
Copy link
Author

We upgraded to React 19 along with MUI v5.16.14. I have now applied a workaround:

  1. In the host application the ThemeProvider is defined like this:
 <ThemeProvider theme={theme}>
      {props.children}
    </ThemeProvider >
  );
  1. In the component that is exposed by the microfrontend I redefined the ThemeProvider like this:
	const theme = useTheme();
	return (
		<ThemeProvider theme={theme}>

Now it seems to be working. Before the upgrade the second step was not needed.

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Mar 20, 2025
@ZeeshanTamboli
Copy link
Member

ZeeshanTamboli commented Mar 21, 2025

I'm not sure what the issue could be without a reproduction. You could check the release changelogs from your previous version to v5.16.14 for any related changes. I'll close this issue.

@ZeeshanTamboli ZeeshanTamboli removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Mar 21, 2025
Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@adiXSG
Copy link

adiXSG commented Mar 27, 2025

Maybe same root cause as #45699

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Popover The React component. component: Popper The React component. See <Popup> for the latest version.
Projects
None yet
Development

No branches or pull requests

4 participants