-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allowed for configuring editor label via config.label property #16792
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good 👍 Only some minor questions/suggestions from me.
[x] Q: What do we do about context config?
- A: It appears that you can merge context and editor configs. See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_context-Context.html#static-function-create.
Can you elaborate? From what I understand, you suggest that label should be set with editor config and not context config, right? Should we document that somehow that setting label
on context is not recommended because it may result in multiple editor instances with the same label? 🤔
I'm going to use an example to explain. What I meant is that you can make the following changes to the manual test diff --git a/packages/ckeditor5-comments/tests/manual/annotations-context.js b/packages/ckeditor5-comments/tests/manual/annotations-context.js
index f8f3dbcd5d..a9fd00d803 100644
--- a/packages/ckeditor5-comments/tests/manual/annotations-context.js
+++ b/packages/ckeditor5-comments/tests/manual/annotations-context.js
@@ -100,7 +100,8 @@ import InlineAnnotations from '../../src/annotations/inlineannotations.js';
editorConfig: {
extraPlugins: [ Bold, Italic, Underline, List, Autoformat ]
}
- }
+ },
+ label: 'Context-wide label'
} );
const editor1 = await createEditor( document.querySelector( '.editors' ), context, channelId, 'editor1' );
@@ -241,7 +242,8 @@ async function createEditor( container, context, channelId, name ) {
editorConfig: {
extraPlugins: [ Bold, Italic, Underline, List ]
}
- }
+ },
+ label: `Editor-level label: ${ name }`
} );
const toggleEditorButton = document.createElement( 'button' ); and because of "label: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oleq thanks for all the explanations and clarifications 👍
The rest of this PR and the code looks good too 🎉
@oleq Could you provide some details of how this works with the multiroot editor. Is there some way of passing the aria-label configuration in as part of the call to
|
This is scheduled for the next release, not published yet. |
@oleq Thanks for the link to that code. I probably have a fairly unique situation where I do not know what editable areas I will be attaching when I setup the mutliroot editor. So configuring labels within the e.g. at this point
|
|
@oleq I'm not sure I have access to So the editor root is setup and the const { editableElements, toolbarElement, editor } = useMultiRootEditor({
// -- config here -- //
}) Later I use the editor.addRoot(id, {
data: getIn(getFieldMeta.current().value, id),
isUndoable: false
}); The There is no direct call to |
Thank you @lnmp4000 for a detailed explanation. The core editor API is ready for your use-case but the react integration isn't. Could you create a corresponding issue in https://github.com/ckeditor/ckeditor5-react/issues, please? Thank you. |
Suggested merge commit message (convention)
Feature: Allowed to configure the accessible editable area label via
config.label
property. Closes #15208. Closes #11863. Closes #9731.MINOR BREAKING CHANGE (ui): The default
aria-label
provided byInlineEditableUIView
is now'Rich Text Editor. Editing area: [root name]'
(previously'Editor editing area: [root name]'
). Use theoptions.label
constructor property to adjust the label.Additional information
I left the comments editor untouched because the recent sidebar a11y PR handles the aria-label for the comments editor.
Q: What do we do about context config?