Repository navigation
fix: keep the registration form from crashing under chrome translate - #75
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Adel2411
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Keeps the registration form working for applicants who translate the page with Chrome's Google Translate.
The crash: Translate replaces text nodes with its own
<font>elements. On SUBMIT,McButtoninserts its spinner before the "SUBMIT" text node, which is no longer in the button, so React throwsNotFoundError: insertBeforeand the whole page falls toglobal-error.tsx, while the request still goes through behind it (react/react#11538).src/lib/translate-dom-guard.tswrapsNode.prototype.insertBeforeandremoveChild. When the node React expects has been moved or replaced, it inserts before (or removes) whatever still holds it, or appends (or does nothing) when it left the page, instead of throwing. Calls on nodes still in place run unchanged, so untranslated pages never reach the fallback. Installed site-wide fromsrc/instrumentation-client.ts, before the app is interactive.translate="no". Translate turned the skill "react" into "réagir"; the labels and questions still translate.src/app/(registrations)/error.tsx, so a crash in the form keeps the menu instead of replacing the root layout. It sharesErrorFallback(src/components/shared/) with(site)/error.tsx.Known limit: under translation, a text React changes afterwards can stay in its old translated form until Translate passes again (e.g. the menu bar countdown). Nothing crashes.
Tested in Chromium with Translate set to French, same flow on both: on
dev, SUBMIT ends on the full error page with theinsertBeforeerror; on this branch, the spinner shows and the result modal opens, with no page error. Unit tests for the guard's fallbacks (translate-dom-guard.test.ts).Closes #71