diff --git a/packages/devextreme/js/__internal/ui/html_editor/m_html_editor.ts b/packages/devextreme/js/__internal/ui/html_editor/m_html_editor.ts index 7dd6fe097f2a..647fde20262a 100644 --- a/packages/devextreme/js/__internal/ui/html_editor/m_html_editor.ts +++ b/packages/devextreme/js/__internal/ui/html_editor/m_html_editor.ts @@ -262,6 +262,7 @@ const HtmlEditor = Editor.inherit({ this._prepareConverters(); this.callBase(); + this._toggleReadOnlyState(); }, _prepareQuillRegistrator() { diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/markup.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/markup.tests.js index cfb070ee11c4..9512fbd3da58 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/markup.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/markup.tests.js @@ -109,6 +109,32 @@ export default function() { }); QUnit.module('Accessibility', () => { + test('aria-readonly should be set on initialization', function(assert) { + const $element = $('#htmlEditor'); + + $element.dxHtmlEditor({ + readOnly: true + }); + + const $editorContent = $element.find(`.${HTML_EDITOR_CONTENT_CLASS}`); + assert.strictEqual($editorContent.attr('aria-readonly'), 'true', 'aria-readonly is set on initialization'); + }); + + test('aria-readonly should be set during option change in runtime', function(assert) { + const $element = $('#htmlEditor'); + + $element.dxHtmlEditor({ + readOnly: false + }); + const instance = $element.dxHtmlEditor('instance'); + + const $editorContent = $element.find(`.${HTML_EDITOR_CONTENT_CLASS}`); + assert.strictEqual($editorContent.attr('aria-readonly'), undefined, 'aria-readonly is properly set on initialization'); + + instance.option('readOnly', true); + assert.strictEqual($editorContent.attr('aria-readonly'), 'true', 'aria-readonly is properly set on runtime'); + }); + test('accessibility roles', function(assert) { const $element = $('#htmlEditor');