Skip to content
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

Error when using <Select /> and Google Chrome with translate #5260

Closed
juliuslissau opened this issue Nov 15, 2023 · 1 comment · Fixed by #5377
Closed

Error when using <Select /> and Google Chrome with translate #5260

juliuslissau opened this issue Nov 15, 2023 · 1 comment · Fixed by #5377
Labels
help wanted Contributions from community are welcome

Comments

@juliuslissau
Copy link

juliuslissau commented Nov 15, 2023

What package has an issue?

@mantine/core

Describe the bug

When using Google Chrome and using the "translate this page" functionality, and the user selects an option on the Select or MultiSelect component (perhaps other components as well?), then the error from the screenshot will occur:

Tested on the newest version of Chrome (I think), version 119 and Mantine 7.2.2 (but I think this might have been an issue for a longer period of time).

Both happens on my website and on the Mantine docs.

error

What version of @mantine/* packages do you have in package.json? (Note that all @mantine/* packages must have the same version in order to work correctly)

7.2.2

If possible, please include a link to a codesandbox with a minimal reproduction

No response

Do you know how to fix the issue

None

Do you want to send a pull request with a fix?

None

Possible fix

Seems like you can disable Google translate option entirely, but of course nice to allow on your website: https://stackoverflow.com/a/76004257/8963287

Also, the problem might be that the Select (and similar components) uses React Fragment instead of a div or similar. This answer says switching away from Fragments solved a similar issue: https://stackoverflow.com/a/74627339/8963287

@rtivital rtivital added the help wanted Contributions from community are welcome label Dec 4, 2023
@manuelbosi
Copy link
Contributor

manuelbosi commented Dec 6, 2023

From this answer https://stackoverflow.com/a/65110044/7491710

Sometimes it happens when users use Google Translate, it mutates text nodes, and React breaks on the next render.

I've made some tests and I figured out the problem is that the option renders its label as pure string without wrapping in any html element.

For now I found this two:

  1. Disable translation on each select option
  2. Wrap option label with something like span or label element

@rtivital I suggest to take the second option, as user I would expect that the google translation works.
I made a PR, let me know if need edits 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributions from community are welcome
Projects
None yet
3 participants