diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts index f7cddb723..d3378a47b 100644 --- a/packages/core/src/Editor.ts +++ b/packages/core/src/Editor.ts @@ -360,6 +360,11 @@ export class Editor extends EventEmitter { this.view = new EditorView(this.options.element, { ...this.options.editorProps, + attributes: { + // add `role="textbox"` to the editor element + role: 'textbox', + ...this.options.editorProps?.attributes, + }, dispatchTransaction: this.dispatchTransaction.bind(this), state: EditorState.create({ doc, @@ -367,14 +372,6 @@ export class Editor extends EventEmitter { }), }) - // add `role="textbox"` to the editor element - this.view.dom.setAttribute('role', 'textbox') - - // add aria-label to the editor element - if (!this.view.dom.getAttribute('aria-label')) { - this.view.dom.setAttribute('aria-label', 'Rich-Text Editor') - } - // `editor.view` is not yet available at this time. // Therefore we will add all plugins and node views directly afterwards. const newState = this.state.reconfigure({