mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 03:39:01 +08:00
Improve accessibility on the editor DOM element (#5734)
* added accessibility attributes to the editor DOM element * added changesets
This commit is contained in:
parent
364231a1bd
commit
a2eea24b5b
5
.changeset/soft-peaches-hang.md
Normal file
5
.changeset/soft-peaches-hang.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@tiptap/core": patch
|
||||
---
|
||||
|
||||
Added role and aria-label attributes to the contenteditable field for better screenreader support and mouseless controls
|
@ -352,6 +352,14 @@ export class Editor extends EventEmitter<EditorEvents> {
|
||||
}),
|
||||
})
|
||||
|
||||
// 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({
|
||||
|
Loading…
Reference in New Issue
Block a user