-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[lab][LoadingButton] Apply wrapping element to prevent React crash on Google page translation #35198
[lab][LoadingButton] Apply wrapping element to prevent React crash on Google page translation #35198
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we even need to add wrappers, maybe changing the conditioning logic could solve this. An option mentioned in #27853 (comment).
@michaldudak why add the "on hold" label? This component is unstable.
@@ -29,6 +29,10 @@ const useUtilityClasses = (ownerState) => { | |||
}; | |||
}; | |||
|
|||
const contentDivStyles = { | |||
display: 'contents' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting trick, it seems to have tons of limitations https://caniuse.com/css-display-contents but maybe it's OK in this context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be tested with assistive technology. I think VoiceOver had big problems with this. I think it's safer to not use display: contents
in the forseeable future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still unsure if display: contents
can be trusted seeing all of the literature written around how problematic it is. I've removed it for now, but if we feel strong about its benefits we can spend some time testing on different combinations of screen readers and browsers. See this other comment: #35198 (comment)
See #27853 (comment) Yes, it's unstable, but if we don't have to introduce breaking changes, especially if the fix is possible in userland, should we? |
@michaldudak This confuses me. It sounds like we either: 1. don't want to fix this bug since we don't think it's important enough for a BC or 2. we should make this component stable since we don't want to introduce BCs. I don't understand the logic for waiting v6. |
My reasoning is: the LoadingButton component, while unstable, has been around for a while, and likely is used in several projects. The workaround in userland is very simple, so working on a fix on our side immediately isn't crucial. |
@michaldudak OK, I propose that we don't tie the fix to a specific major version then. It sounds like we are more on case 1. (we don't think it's important enough). So effectivement, we are waiting for the pain to grow, more people to complain about it, to feel that working on it is the lowest opportunity cost. Maybe we will fix it in v5.34.0 or maybe in v7.0.0 or maybe never. |
that issue was responsible for a bug in my current sprint :D |
9d8651e
to
9b6e3a1
Compare
Netlify deploy preview
Bundle size reportDetails of bundle changes (Toolpad) |
Hey @BartJanvanAssen! I'm picking picking this up to land it for v6. I introduced two changes in 9b6e3a1:
Regarding number 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aarongarciah may I ask you to add a section explaining this change in the migration guide, as it might be a breaking change for some users 😊
@DiegoAndai entry added to the migration guide 883ace8 |
20b756b
to
883ace8
Compare
Thanks, may I ask you to move it to the v5 breaking changes: https://github.com/mui/material-ui/blob/next/docs/data/material/migration/migration-v5/migration-v5.md#breaking-changes |
@DiegoAndai done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @aarongarciah! Here's the before and after testing that the issue is fixed
Before
Screen.Recording.2024-06-14.at.11.41.24.mov
After
Screen.Recording.2024-06-14.at.11.42.55.mov
… Google page translation (mui#35198) Co-authored-by: Aarón García Hervás <aaron@mui.com>
Hey folks 👋
I ran into this issue where some of our customers on our site were trapped by this react crashing loading button. I wanted to to invest some time to get it out of the package.
Use case summary:
Using the LoadingButton while have Google translation (chrome feature) active on your site.
Problem: Google modifies the button contents and React can't figure out its bindings anymore. Causes crash 💥
How to reproduce:
https://codesandbox.io/s/dry-water-eig2e7?file=/demo.tsx
Steps:
Why this solution?
I've implemented one of the suggestion in the issue, tested it locally and it seemed to work out perfectly.
😃 This is my first contribution to MUI, so if I need to change something, let me know.
Closes #27853