Kaynağa Gözat

Aligned BoxedEditorUIView to the new LabelView API.

Aleksander Nowodzinski 5 yıl önce
ebeveyn
işleme
d406489514

+ 3 - 7
packages/ckeditor5-ui/src/editorui/boxed/boxededitoruiview.js

@@ -9,7 +9,6 @@
 
 import EditorUIView from '../../editorui/editoruiview';
 import LabelView from '../../label/labelview';
-import uid from '@ckeditor/ckeditor5-utils/src/uid';
 
 /**
  * The boxed editor UI view class. This class represents an editor interface
@@ -26,8 +25,6 @@ export default class BoxedEditorUIView extends EditorUIView {
 	constructor( locale ) {
 		super( locale );
 
-		const ariaLabelUid = uid();
-
 		/**
 		 * Collection of the child views located in the top (`.ck-editor__top`)
 		 * area of the UI.
@@ -53,7 +50,7 @@ export default class BoxedEditorUIView extends EditorUIView {
 		 * @readonly
 		 * @member {module:ui/view~View} #_voiceLabelView
 		 */
-		this._voiceLabelView = this._createVoiceLabel( ariaLabelUid );
+		this._voiceLabelView = this._createVoiceLabel();
 
 		this.setTemplate( {
 			tag: 'div',
@@ -68,7 +65,7 @@ export default class BoxedEditorUIView extends EditorUIView {
 				role: 'application',
 				dir: locale.uiLanguageDirection,
 				lang: locale.uiLanguage,
-				'aria-labelledby': `ck-editor__aria-label_${ ariaLabelUid }`
+				'aria-labelledby': this._voiceLabelView.id
 			},
 
 			children: [
@@ -106,7 +103,7 @@ export default class BoxedEditorUIView extends EditorUIView {
 	 * @private
 	 * @returns {module:ui/label/labelview~LabelView}
 	 */
-	_createVoiceLabel( ariaLabelUid ) {
+	_createVoiceLabel() {
 		const t = this.t;
 		const voiceLabel = new LabelView();
 
@@ -114,7 +111,6 @@ export default class BoxedEditorUIView extends EditorUIView {
 
 		voiceLabel.extendTemplate( {
 			attributes: {
-				id: `ck-editor__aria-label_${ ariaLabelUid }`,
 				class: 'ck-voice-label'
 			}
 		} );

+ 1 - 1
packages/ckeditor5-ui/tests/editorui/boxed/boxededitoruiview.js

@@ -34,7 +34,7 @@ describe( 'BoxedEditorUIView', () => {
 			expect( view.element.getAttribute( 'dir' ) ).to.equal( 'ltr' );
 			expect( element.attributes[ 'aria-labelledby' ].value )
 				.to.equal( view.element.firstChild.id )
-				.to.match( /^ck-editor__aria-label_\w+$/ );
+				.to.match( /^ck-editor__label_\w+$/ );
 		} );
 
 		it( 'bootstraps the voice label from template', () => {