Repository navigation
Conversation
kabaros
approved these changes
Nov 25, 2026
3 of 5 tasks
Collaborator
|
@alexcpn thanks for the contribution - our CI pipeline blocked the PR because the commits aren't signed. Would you be able to sign them and force push? |
Browser translation (e.g. Google Translate) replaces a button's label text node with <font> elements. When `loading` (or `icon`) was then turned on, React tried to insert the loader before the detached text node and threw NotFoundError, crashing the whole app. The label is now wrapped in a span with `display: contents`, so React always has a stable element as the insertion reference and the layout is unchanged. Refs: LIBS-876 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
alexcpn
force-pushed
the
LIBS-876/button-google-translate-crash
branch
from
December 4, 2026 13:44
ae06cba to
e157fb9
Compare
|
Author
|
@kabaros thanks for the review! I've signed the commit and force-pushed, so it should now show as verified. Let me know if anything else is needed. |
This branch has not been deployed
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.



Implements LIBS-876
Relates to DHIS2-15842 (Capture crashes when saving a new enrollment with Google Translate on).
Description
When the browser translates the page, Google Translate replaces a
Button's label text node with<font>elements. Ifloadingthen becomes true, React inserts the.loaderspan before the original text node, which is no longer a child of the button. React throwsNotFoundError: Failed to execute 'insertBefore' on 'Node'and the whole app crashes. Adding aniconafter translation fails the same way.The fix wraps the label in
<span className="button-label">, so React's insertion reference is always an element it owns. Translation then only changes nodes inside that span.The span has
display: contents, so the label's children remain direct flex items of the button and the layout does not change.How it was tested
<font>element), then turnloadingon or add anicon. Both fail onmasterwithNotFoundErrorand pass with this change.components/buttonpass.eslintandprettier --checkare clean for the package (one existingreact-hooks/exhaustive-depswarning inbutton.jsis untouched).yarn test: 1047 pass, 3 fail incomponents/selector-bar. Those 3 fail the same way on unmodifiedmaster.getBoundingClientRect()for every<button>and every icon, loader and svg inside it, across all 45 stories of the button package (79 buttons), onmasterand on this branch. All boxes are identical.Known issues
button > svgfor elements passed aschildren) will no longer match, because children are now inside the.button-labelspan.Checklist
No props changed, so there are no API doc or Storybook changes.
Screenshots
No visual change. See the layout measurement above.
AI disclosure
This change was written and tested by an AI model, Claude Fable 5.2 (via Claude Code), and submitted by a human contributor.
#T4G (tokens for good project)
🤖 Generated with Claude Code