-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
[BUG] Error when using google translate #1206
Comments
This is a well-known React issue, that crops up every few months on different projects I'm working on. Definitely extremely annoying. Usually simply disabling translation for the whole page works well enough, but definitely a bad idea for the medusa docs here. I'll have more time to try to work out a more permanent solution when using <span
id={elementId}
data-tooltip-content={text}
data-tooltip-html={html}
data-tooltip-id={elementId}
className={clsx(className, "notranslate")}
translate="no"
>
{children}
</span> Adding This might work well as a temporary fix, but we might be able to improve how the tooltip handles DOM changes internally. Let us know what you find. |
Hello! I tried your solution and I was only able to make it work by adding another wrapper span: <span className={clsx(className, "notranslate")} translate="no"> // new
<span
id={elementId}
data-tooltip-content={text}
data-tooltip-html={html}
data-tooltip-id={elementId}
>
{children}
</span>
<ReactTooltip
anchorId={elementId}
// anchorSelect={elementId ? `#${elementId}` : undefined}
className={clsx(
"!text-compact-x-small !shadow-elevation-tooltip dark:!shadow-elevation-tooltip-dark !rounded-docs_DEFAULT",
"!py-docs_0.25 !z-[399] hidden !px-docs_0.5 lg:block",
"!bg-medusa-bg-component",
"!text-medusa-fg-base text-center",
tooltipClassName
)}
wrapper="span"
noArrow={true}
positionStrategy={"fixed"}
opacity={1}
{...tooltipProps}
>
{tooltipChildren}
</ReactTooltip>
</span> Will use this fix for now, but yes would be great if we can get it fixed. Thanks for the help! Not sure if I should close the issue so feel free to do so if it's not necessary anymore. |
This issue is stale because it has not seen activity in 30 days. Remove the |
This issue is stale because it has not seen activity in 30 days. Remove the |
Check the troubleshooting page before opening an issue!
Make sure your problem isn't already covered at the troubleshooting page: https://react-tooltip.com/docs/troubleshooting
Bug description
The Medusa documentation uses
react-tooltip
for all tooltips. We've had multiple users report an issue when using google translate (see here) where the website crashes with the errorNotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
After investigation, the error seems to result from google trying to replace the tooltip's content with the translated content.
Here's the error trace in development:
(Shortened the rest down for readability)
I confirmed that when i remove the use of
react-tooltip
in theTooltip
component, the issue doesn't occur anymore.This is the content of the
Tooltip
component:While this was reported on our documentation website running on Docusaurus, I was also able to reproduce it on our new documentation running on Next.js.
Version of Package
v5.27.1
To Reproduce
Expected behavior
The page shouldn't crash when using google translate
Screenshots
Screen.Recording.2024-07-05.at.4.38.30.PM.mov
Desktop (please complete the following information if possible or delete this section):
Smartphone (please complete the following information if possible or delete this section):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: