-
Notifications
You must be signed in to change notification settings - Fork 10k
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
[Blazor] Microsoft Edge translation causes crash because of DOM manipulation #47111
Comments
@scandler thanks for contacting us. This is something that you should be able to control in your markup with |
It should, but it doesn't. What does work is adding: But if this is the solution, to prevent the app from being translated, shouldn't it be part of the default blazor template? It will occour on every non-English machine I guess. |
@scandler that's likely the case because:
|
To learn more about what this message means, what to expect next, and how this issue will be handled you can read our Triage Process document. |
Same issue occurs when a user translates the page in chrome |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
We'll try to see how some other frameworks behave here and go from there. |
To learn more about what this message means, what to expect next, and how this issue will be handled you can read our Triage Process document. |
I ran into this problem in a production system, and it took us 4 days to figure out what the heck was going on. Here's how we fixed and prevented it for good:
And if you want to go the extra mile, you can watch a div for undesired inner structural changes, thereby catching any undesired auto-translator action. Add the following div to the static part of your html body (outside the app-div):
add the following css:
And finally, add the following JS code to your html page, or to an external script file:
You may want to make the message prettier, maybe even calling Blazor via JS interop. But remember that Blazor may already be "dead" once the translator has changed the DOM. So I opted for a plain JS alert box. |
Thanks for contacting us. |
Is there an existing issue for this?
Describe the bug
Create new project in Visual Studio from Blazor WASM App template with authentication.
Run in Edge. On my machine, Edge translates English to Dutch which results in console errors:
blazor.webassembly.js:1
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Cannot read properties of null (reading 'removeChild')
TypeError: Cannot read properties of null (reading 'removeChild')
and application is stuck on "Authenticating..." (or "Machtigen" translated by Edge)
Expected Behavior
Translation will work or translation blocked by default, preventing DOM manipulations
Steps To Reproduce
I think to reproduce it on a machine with an English Edge and Windows etc: the best way is to force the page into another language is by changing to in the wwwroot/index.html
Exceptions (if any)
No response
.NET Version
7.0.103
Anything else?
No response
The text was updated successfully, but these errors were encountered: