Editor loses role="textbox" after setOptions when editorProps.attributes is set
Author: niba1122Created Sep 29, 2026Updated Sep 29, 2026
Labelsarea: corearea: reactcomplexity: easyimpact: medium
Affected Packages
core, react
Tiptap Version
2.26.1 (the same code is still on main)
Browser Used
Not browser-specific
What happened?
When I pass editorProps.attributes, the editor element loses role="textbox" after the first re-render.
const editor = useEditor({
extensions: [StarterKit],
editorProps: {
attributes: { class: "my-editor" },
},
});- On mount, the element has
role="textbox". - After the component re-renders, the element only has
class="my-editor".role="textbox"is gone.
This is the usage shown in the docs ("Style the editor").
The cause seems to be:
createView()merges the default role:{ role: 'textbox', ...editorProps?.attributes }.setOptions()callsthis.view.setProps(this.options.editorProps)without that merge, so the user attributes replace the default role.useEditor()callssetOptions()on re-render when options change (a neweditorPropsobject on every render), and also inscheduleDestroy()under StrictMode.
Screen readers and getByRole("textbox") in tests no longer find the editor.
Expected Behavior
role="textbox" stays on the editor element after setOptions() / re-renders, the same as on mount.
Additional Context (Optional)
Workaround: add role: "textbox" to editorProps.attributes yourself.
Source: ueberdosis/tiptap