-
-
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
[material-ui][LoadingButton] Crashes React when Chrome has Translated the Page #27853
Comments
Found an explanation: facebook/react#11538 (comment) There are a few solutions to fix this:
|
I guess this will be more common now that we removed a bunch of Turns out these make the components resilient to google translate. We can never fully fix this since we rely on React and the browser here. But maybe It may make sense to always render the label of the button but hide it so that the text content is stable. That way React won't have to reconcile text content (outside of the cases where you would also write |
Any update on this one? I face this issue on version: Use case:
Any change we can just implement the suggestion of @eps1lon? Would be pleased to implement it if you want it. |
I've looked it over, made some changes to the loading button to try and wrap it with a div and test it locally. No more crashing React. Works fine 👍🏻 . However, the spinner's circle svg (child node of the button) somehow gets disconnected of its styles. No idea how to prevent that yet. I've checked this change https://github.com/mui/material-ui/pull/23237/files but attaching class 'notranslate' to the circularprogress makes no difference. styles will still be removed. Update: Google translates the style tag, when i remove the animation and keyframes from the style tag it seems to not happen anymore. looking further.. Update 2: the styles removal got fixed by start using the StyledEngineProvider + injectFirst prop. |
Made a PR to get the translate bug in loading button fixed. Let me know if i need to make any adjustments. |
@BartJanvanAssen as far as I tested the issue can be fixed by using |
👍 I agree, this may break layouts that assume the content of the button is not wrapped in another container. |
I confirm this is still happening. |
The issue is not mentionned here: https://mui.com/material-ui/api/loading-button/ It's the first result in Google when searching for "mui loading button" My team stumbled on this issue and it made us waste time. |
@DiegoAndai, what do you think about adding the fix to v6? It's a breaking change, as it could mess up layouts that depend on the lack of additional elements under the button. |
@michaldudak is this the fix?: #35198 Or would it be enough to swap This one is tricky because I fail to imagine breaking changes for the change 😅 Do you remember which ones you were thinking about in this comment? |
It doesn't really matter if it's a |
Adding it to the v6 milestone |
Current Behavior 😯
React crashes when changing the loading state of a LoadingButton when Chrome has translated the page:
Uncaught DOMException: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
Steps to Reproduce 🕹
The text was updated successfully, but these errors were encountered: