fix: prevent browser auto-translate from crashing React DOM#283
Merged
fix: prevent browser auto-translate from crashing React DOM#283
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideDisables browser auto-translation (especially Google Translate) for the main HTML document to prevent translation-induced React DOM crashes by adding appropriate attributes and meta tags. Sequence diagram for browser auto-translate vs React DOM after fixsequenceDiagram
actor User
participant Browser
participant GoogleTranslate
participant ReactApp
User->>Browser: Open AppFlowy Web page
Browser->>ReactApp: Load index.html
ReactApp-->>Browser: Render React DOM
alt With_auto_translate_disabled
Browser->>Browser: Detect translate=no attribute
Browser->>Browser: Read meta google=notranslate
Browser--xGoogleTranslate: Block automatic translation
ReactApp-->>User: UI remains stable
else Without_auto_translate_disabled
Browser->>GoogleTranslate: Allow automatic translation
GoogleTranslate-->>Browser: Modify DOM text nodes
Browser->>ReactApp: Inject translated content
ReactApp-->>Browser: Virtual DOM mismatches real DOM
Browser-->>User: Potential React DOM crash or errors
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider whether disabling translation at the
<html>level is too broad for your use case; if some parts of the app should remain translatable, you may want to scopetranslate="no"to specific containers instead. - Since this change targets Google’s auto-translate specifically, evaluate whether similar meta or attributes are needed for other major translation providers if cross-browser behavior is important.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider whether disabling translation at the `<html>` level is too broad for your use case; if some parts of the app should remain translatable, you may want to scope `translate="no"` to specific containers instead.
- Since this change targets Google’s auto-translate specifically, evaluate whether similar meta or attributes are needed for other major translation providers if cross-browser behavior is important.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Description
Checklist
General
Testing
Feature-Specific
Summary by Sourcery
Bug Fixes: