fix: add translate=no attribute to Editable component to avoid DOM desynchronization#5959
Merged
dylans merged 1 commit intoianstormtaylor:mainfrom Oct 12, 2025
Merged
Conversation
🦋 Changeset detectedLatest commit: 9674f5e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
dylans
approved these changes
Oct 12, 2025
This was referenced Oct 12, 2025
Merged
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
This PR adds
translate='no'to the Editable component to prevent textareas from getting desynced due to browser or extension-based translations. I’ve verified this behavior in Notion, Google Docs, and Lexical, all of which use eithernotranslateorskiptranslateclass buttranslateattribute is now widely supported across browsers.Issue
Fixes: #5951
Example
Before:
Screen.Recording.2025-10-12.at.10.12.56.PM.mov
After:
Screen.Recording.2025-10-12.at.10.14.08.PM.mov
Context
This issue occurs because when the page is translated, all text content is replaced with its translated version. This can cause syncing issues between the DOM text and Slate’s internal state. In particular, when the translated text becomes longer than the original, it results in the
point.offsetexceeding the valid range in thetoDOMPointfunction, leading to the error:Cannot resolve a DOM point from Slate point.To address this, I checked how other editors handle translation, including Google Docs, Notion, and Lexical, and noticed that they exclude their editable regions from being translated. This approach makes sense since editable content should not be translated unless the translation can be synchronized with the editor’s internal state (
editor.childrenin our case).Please let me know if this approach works for us.
Checks
yarn test.yarn lint. (Fix errors withyarn fix.)yarn start.)yarn changeset add.)