Is it currently possible to set 'id' on 'cm-content'?

Hey everyone, apologies if I’ve missed something obvious but I’ve not been able to find my answer in documentation. We’ve got some a11y rules set up on our project, and code-mirror is tripping them up due to a lack of defined label for cm-content. Essentially, I would like to control the ID of the cm-content block, so that I can associate a label with it. The ID would be dynamic, so it’s something I’d have to be able to instantiate CM with.

Is this something supported via the current API?

Thank you for your help :slight_smile:

You can use an extension like EditorView.contentAttributes.of({id: "x", "aria-label": "y"}) to add attributes to the editable element.

1 Like