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

Wrap text node to reduce Google Translate bug #1814

Merged
merged 3 commits into from
Nov 1, 2024

Conversation

nedredmond
Copy link
Contributor

@nedredmond nedredmond commented Oct 31, 2024

It looks like Google Translate doesn't play nicely with React.
There is a known issue that Google plans to address... one day, maybe.
In the short term, it looks like if we wrap text nodes in elements, we should be good to go.

Issue: LEMS-2574

Testing:
Use Google Translate on any radio widget exercise and do something that causes the radio widgets to change state to render a text node (the easiest way was showing rationales). The red bar of doom doesn't show.

@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Oct 31, 2024

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/rude-spies-doubt.md, packages/perseus/src/multi-items/__tests__/__snapshots__/multi-renderer.test.tsx.snap, packages/perseus/src/widgets/group/__snapshots__/group.test.tsx.snap, packages/perseus/src/widgets/radio/choice-icon/choice-icon.tsx, packages/perseus/src/widgets/radio/__tests__/__snapshots__/radio.test.ts.snap

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

@khan-actions-bot khan-actions-bot requested a review from a team October 31, 2024 17:31
Copy link
Contributor

github-actions bot commented Oct 31, 2024

Size Change: -33 B (0%)

Total Size: 857 kB

Filename Size Change
packages/perseus/dist/es/index.js 408 kB -33 B (-0.01%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38.8 kB
packages/keypad-context/dist/es/index.js 760 B
packages/kmath/dist/es/index.js 4.27 kB
packages/math-input/dist/es/index.js 77.8 kB
packages/math-input/dist/es/strings.js 1.79 kB
packages/perseus-core/dist/es/index.js 1.48 kB
packages/perseus-editor/dist/es/index.js 282 kB
packages/perseus-linter/dist/es/index.js 22.2 kB
packages/perseus/dist/es/strings.js 3.4 kB
packages/pure-markdown/dist/es/index.js 3.66 kB
packages/simple-markdown/dist/es/index.js 12.4 kB

compressed-size-action

@jeremywiebe
Copy link
Collaborator

Hrm. I've looked at this Sentry issue many times and had no idea where it came from. I wonder if it's all down to Google Translate or other DOM manipulation tooling?

https://khanacademyorg.sentry.io/issues/4737185317/?project=15744&query=is%3Aunresolved%20Perseus&referrer=issue-stream&statsPeriod=14d&stream_index=0

@nedredmond
Copy link
Contributor Author

@jeremywiebe seems likely!

Copy link
Contributor

github-actions bot commented Oct 31, 2024

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (804b9b8) and published it to npm. You
can install it using the tag PR1814.

Example:

yarn add @khanacademy/perseus@PR1814

If you are working in Khan Academy's webapp, you can run:

./dev/tools/bump_perseus_version.sh -t PR1814

Copy link
Member

@benchristel benchristel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

let color;
let backgroundColor: string | undefined;
let borderColor: string;
let color: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing up these type issues!

Copy link
Contributor

@mark-fitzgerald mark-fitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooof. Adding elements "just because" makes me sad.

Thanks for finding a simple work-around!

@nedredmond nedredmond merged commit 035191c into main Nov 1, 2024
9 checks passed
@nedredmond nedredmond deleted the ned/reduce-google-translate-bug branch November 1, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants