Add Accessibility for TipTap RTE input fields (#20157)

* Add Accessibility for RTE input fields

* add localization key for EN

* Adds `aria-required` attribute

---------

Co-authored-by: Oskar kruger <obk@umbraco.dk>
Co-authored-by: leekelleher <leekelleher@gmail.com>
This commit is contained in:
Krüger
2025-09-17 14:36:16 +02:00
committed by GitHub
parent 7483f20191
commit 8a48d17580
2 changed files with 7 additions and 1 deletions

View File

@@ -2774,6 +2774,7 @@ export default {
wordWrapConfigDescription: 'Enable word wrapping in the code editor.',
},
rte: {
label: 'Rich Text Editor',
config_blocks: 'Available Blocks',
config_blocks_description: 'Define the available blocks.',
config_ignoreUserStartNodes: 'Ignore User Start Nodes',

View File

@@ -173,7 +173,12 @@ export class UmbInputTiptapElement extends UmbFormControlMixin<string, typeof Um
this._editor = new Editor({
element: element,
editable: !this.readonly,
editorProps: { attributes: { 'aria-label': this.label ?? 'Rich Text Editor' } },
editorProps: {
attributes: {
'aria-label': this.label || this.localize.term('rte_label'),
'aria-required': this.required ? 'true' : 'false',
},
},
extensions: tiptapExtensions,
content: this.#value,
injectCSS: false, // Prevents injecting CSS into `window.document`, as it never applies to the shadow DOM. [LK]