From 395d0a77f18da2a5b0990bde7182f305aa191de0 Mon Sep 17 00:00:00 2001 From: Nikki Gonzales <38495263+nikkithelegendarypokemonster@users.noreply.github.com> Date: Wed, 4 Sep 2024 01:50:23 +0800 Subject: [PATCH] Initial fix --- .../ui/html_editor/m_html_editor.ts | 1 + .../htmlEditorParts/markup.tests.js | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) 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');