Skip to content

Ability to set label when creating editable element #596

@lnmp4000

Description

@lnmp4000

In useMultiRootEditor.tsx the editable elements are created with a call to

editable = ui.view.createEditable( rootName, innerRef.current );

This API can actually take 3 parameters:
Parameters:

  • editableName : string
    The name for the editable.

  • [ editableElement ] : HTMLElement
    DOM element for which the editable should be created.

  • [ label ] : string
    The accessible editable label used by assistive technologies.

The above call should be updated so it passes in the label element. This would need to be passed as a property from the code that sets up the editableElements array

	const editableElements = roots.map(
		rootName => (
			<EditorEditable
				key={rootName}
				id={rootName}
				rootName={rootName}
				semaphore={semaphore}
                                label={label} //proposed new property to pass label
			/>
		)
	);

So ideally when creating a root we can specify some additional config (the label)

I setup my root with a call to

editor.addRoot(id, {
                data: getIn(getFieldMeta.current().value, id),
                isUndoable: false,
                config: {  //proposed new property to pass the label 
                     label:'My Label'
               }
            });

If this were extended to allow an optional label to be specified, that would be very useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions