diff --git a/src/index.tsx b/src/index.tsx index f83a11db..313fea6b 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -330,6 +330,8 @@ class ReactQuill extends React.Component { */ createEditor(element: Element, config: QuillOptions) { const editor = new Quill(element, config); + // Prevent browser auto-translation from mutating editor contents while typing. + editor.root.setAttribute('translate', 'no'); if (config.tabIndex != null) { this.setEditorTabIndex(editor, config.tabIndex); } diff --git a/test/index.js b/test/index.js index 5bb1cafe..a0f57d5c 100644 --- a/test/index.js +++ b/test/index.js @@ -50,6 +50,12 @@ describe('', function() { expect(quill instanceof Quill).to.equal(true); }); + it('disables browser translation on the editable root', () => { + const wrapper = mountReactQuill(); + const quill = getQuillInstance(wrapper); + expect(quill.root.getAttribute('translate')).to.equal('no'); + }); + it('passes options to Quill from props', () => { const enabledFormats = ['underline', 'bold', 'italic']; const props = {