Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit 13af143

Browse files
authored
Merge pull request #302 from ckeditor/t/ckeditor5/1404
Other: The image widget toolbar should have a proper `aria-label` attribute (see ckeditor/ckeditor5#1404).
2 parents 6c74d59 + 163bc4b commit 13af143

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

lang/contexts.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
"Text alternative": "Label for the image text alternative input.",
1010
"Enter image caption": "Placeholder text for image caption displayed when caption is empty.",
1111
"Insert image": "Label for the insert image toolbar button.",
12-
"Upload failed": "Title of the notification displayed when upload fails."
12+
"Upload failed": "Title of the notification displayed when upload fails.",
13+
"Image toolbar": "The label used by assistive technologies describing an image toolbar attached to an image widget."
1314
}

src/imagetoolbar.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ export default class ImageToolbar extends Plugin {
4444
*/
4545
afterInit() {
4646
const editor = this.editor;
47+
const t = editor.t;
4748
const widgetToolbarRepository = editor.plugins.get( WidgetToolbarRepository );
4849

4950
widgetToolbarRepository.register( 'image', {
51+
ariaLabel: t( 'Image toolbar' ),
5052
items: editor.config.get( 'image.toolbar' ) || [],
5153
getRelatedElement: getSelectedImageWidget,
5254
} );

tests/imagetoolbar.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ describe( 'ImageToolbar', () => {
8989
balloonClassName: 'ck-toolbar-container'
9090
} );
9191
} );
92+
93+
it( 'should set aria-label attribute', () => {
94+
toolbar.render();
95+
96+
expect( toolbar.element.getAttribute( 'aria-label' ) ).to.equal( 'Image toolbar' );
97+
98+
toolbar.destroy();
99+
} );
92100
} );
93101

94102
describe( 'integration with the editor focus', () => {

0 commit comments

Comments
 (0)