[lab][LoadingButton] Apply wrapping element to prevent React crash on Google page translation#35198
Conversation
oliviertassinari
left a comment
There was a problem hiding this comment.
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.
| }; | ||
|
|
||
| const contentDivStyles = { | ||
| display: 'contents' |
There was a problem hiding this comment.
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.
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.
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,
|
DiegoAndai
left a comment
There was a problem hiding this comment.
@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 |
DiegoAndai
left a comment
There was a problem hiding this comment.
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 <[email protected]>
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