-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Backdrop] Stuck open at 0% opacity and blocks all clicks on the page due to react-transition-group bug #32286
Comments
Thanks for creating the issue and linking it to the react transition group's issue. Let's keep an eye on it to see if the maintainers will provide some feedback. I see that there is another issue opened related to React 18 there too. |
This is a very hacky solution but ... it does solve the issues caused by this on modern browsers which should solve for 90% of our applications users ... I would not normally promote such a solution but without it the bug is a complete show stopper div:has(div[style*="opacity: 0"]) {
pointer-events: none;
} or div.MuiModal-root:has(> div[style*="opacity: 0"]) {
pointer-events: none;
} |
any updates in this ? |
I have faced a similar problem. My application uses Next.js v12 and MUI v5, and the user makes screen transitions from the menu in the Drawer. In this situation, on rare occasions, the backdrop drawn by the MUI Drawer remains transparent on the screen, making the application inoperable. When the Drawer is working correctly, the Backdrop style is given I debugged with React Developer Tools and confirmed that the state that the React Transition Group We do not have a procedure to reproduce this problem, as it requires a certain scale and occurs stochastically. |
We have encountered the same problem with sites of two of our clients. Both are running on next 13 and using MUI 5. For us, it also happens when a route transition is triggered while a backdrop is visible. This happens while a dialog is open or our menu is open on which we add a backdrop. I'm glad someone found the root of the problem, as it was impossible for us to recreate the bug consistently. Most of the time it will unmount as it should, but sometimes it gets stuck. Hope someone finds a fix for it soon. |
I implemented the hack @doflo-dfa mentioned in our theme config, so it only applies for the backdrop. This works fine for until the issue gets fixed. const theme = createTheme({
// ...
components: {
MuiBackdrop: {
styleOverrides: {
root: {
'&[style*="opacity: 0"]': {
pointerEvents: 'none',
},
},
},
},
},
}); I've also found a way to reproduce this bug in a specific instance. If I open https://nextjs-azalp-9294f0bzd-azalp-de.vercel.app/ in browserstack with edge 112, it gets stuck when I double-click on a sub menu item. |
I'm also encountering this with the Drawer component and CPU-throttled devices |
I'm facing this with Autocomplete (I think). It's really difficult to reproduce. |
Seeing the same on the @mui/x-date-pickers/DatePicker, I assume they share some code. Doesn't seem to be an opacity on it to hook into. |
I'm running into this problem right now after clicking a I finally looked up "mui backdrop stays open" on Google and found this thread. This solution works but it'd be nice if the backdrop didn't stay permanently open... |
To pick up the aforementioned workaround, I had to use import { backdropClasses } from "@mui/material/Backdrop";
// within createTheme
MuiModal: {
styleOverrides: {
root: {
[`&:has(> div.${backdropClasses.root}[style*="opacity: 0"])`]: {
pointerEvents: "none",
},
},
},
}, Since for me, it was the modal and not the backdrop that blocked pointer events. Running
also observing issue when transitioning to another page by using a Link in a Menu. |
This bug just started happening for my project after updating from Remix.run version 1 to version 2.4. I've used the theme hack to get by as well. |
I'm getting the same bug in e2e tests, can't reproduce it manually.
Testing error
That's happening on the Select component, but the layout is: Page > Drawer > Select. Maybe that's the reason – we have nested Backdrop components. this solution helped #32286 (comment) |
Any solution to this? I'm routing to other pages when this issue occurs (SPA). If I click on the same menu item to route to the same page, it doesn't happen. I have to click twice elsewhere on the page for the backdrop to be removed so I can continue interacting with the page. The interesting thing is, once I've clicked off twice, and navigate to another page using the drawer, the backdrop works as expected. It seems to be a one off occurrence. If you do a full page refresh, then the issue appears again. EDIT: If I downgrade from React 18 to React 17 (specifically 17.0.2), I don't see the issue anymore. |
I run into the same issue with NextJS 13 and MUI v5, specifically on Android Chrome and Drawer-components in certain (and very repeatable) situations. I had to adapt @spicattutti solution to apply to Drawer as well:
|
Our users are also effected by this issue (Next 14, Mui 5.15.15). The Dialog component and backdrop are still intermittently rendered on the page with a 0 opacity when the app loads , even though open={false}. The workaround above does allow the background to be clickable but the page is not scrollable. This makes the UI unresponsive unless the user refreshes the page. Seems to effect some users more than others. Upvote for a fix as it makes for a poor app experience. |
Hello, I am facing the same problem on React 18.2.0 with Mui 5.13.4 or 5.15.15. I'm using the Menu component which adds BackDrop on opening as expected. But the strange thing is that the problem never happened before and after N build it only starts happening in production when the project is built. And never in devloppement webpack serve After 3 days of investigating to find what changes are causing the issue, I discovered that this happens when the bundle size exceeds 1.8 MiB and it has nothing to do with any code I add. The CSS trick worked fine but the BackDrop and its container are still on DOM. Waiting for a fix Thanks |
Current behavior 😯
backdrop should always unmount when animation is done
Expected behavior 🤔
backdrop gets stuck open, blocks interaction with page
Steps to reproduce 🕹
Honestly it is hard to replicate. Turn on strict mode and interact with the Menu rapidly, or hack the code to unmount & re-mount with the "existing" state when
onExit
fires but beforeonExited
Context 🔦
Please see this issue where I have done detailed work to isolate and write up what the issue is.
reactjs/react-transition-group#817
As shown here it gets stuck with
in={false}
andEXITING
, it does not ever gotoEXITED
and unmount, from my user's perspective the whole app is crashed/frozen and they need to reload the page now.This is because
onExited
fails to fire, due to race conditions, and it never hits here https://github.com/mui/material-ui/blob/master/packages/mui-base/src/PopperUnstyled/PopperUnstyled.js#L202-L204Your environment 🌎
Chrome, but it's irrelevant based on what I understand about this bug
`npx @mui/envinfo`
The text was updated successfully, but these errors were encountered: