From efcbd2294a8eaffff8b214c6dfb6393e45cd80c9 Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Thu, 8 Aug 2019 15:46:29 +0200 Subject: [PATCH 1/3] Add aria label for image toolbar. --- lang/contexts.json | 3 ++- src/imagetoolbar.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lang/contexts.json b/lang/contexts.json index 2f9d4959..3ca7f607 100644 --- a/lang/contexts.json +++ b/lang/contexts.json @@ -9,5 +9,6 @@ "Text alternative": "Label for the image text alternative input.", "Enter image caption": "Placeholder text for image caption displayed when caption is empty.", "Insert image": "Label for the insert image toolbar button.", - "Upload failed": "Title of the notification displayed when upload fails." + "Upload failed": "Title of the notification displayed when upload fails.", + "Image toolbar": "The label describing an image toolbar attached to an image widget used by assistive technologies." } diff --git a/src/imagetoolbar.js b/src/imagetoolbar.js index fe0ce8ee..65e37081 100644 --- a/src/imagetoolbar.js +++ b/src/imagetoolbar.js @@ -44,9 +44,11 @@ export default class ImageToolbar extends Plugin { */ afterInit() { const editor = this.editor; + const t = editor.t; const widgetToolbarRepository = editor.plugins.get( WidgetToolbarRepository ); widgetToolbarRepository.register( 'image', { + ariaLabel: t( 'Image toolbar' ), items: editor.config.get( 'image.toolbar' ) || [], getRelatedElement: getSelectedImageWidget, } ); From 3167ec4319ed9e76ebbc5072a233b9bc8eeaed83 Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Thu, 8 Aug 2019 16:49:10 +0200 Subject: [PATCH 2/3] Add test checking aria-label. --- tests/imagetoolbar.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/imagetoolbar.js b/tests/imagetoolbar.js index 7f54dd54..661395e9 100644 --- a/tests/imagetoolbar.js +++ b/tests/imagetoolbar.js @@ -89,6 +89,14 @@ describe( 'ImageToolbar', () => { balloonClassName: 'ck-toolbar-container' } ); } ); + + it( 'should set aria-label attribute', () => { + toolbar.render(); + + expect( toolbar.element.getAttribute( 'aria-label' ) ).to.equal( 'Image toolbar' ); + + toolbar.destroy(); + } ); } ); describe( 'integration with the editor focus', () => { From 163bc4be733b37e1c04dabfcc6f34a29cdc25d2a Mon Sep 17 00:00:00 2001 From: Aleksander Nowodzinski Date: Tue, 13 Aug 2019 16:43:21 +0200 Subject: [PATCH 3/3] Improvements to contexts.json. --- lang/contexts.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/contexts.json b/lang/contexts.json index 3ca7f607..2106bdd0 100644 --- a/lang/contexts.json +++ b/lang/contexts.json @@ -10,5 +10,5 @@ "Enter image caption": "Placeholder text for image caption displayed when caption is empty.", "Insert image": "Label for the insert image toolbar button.", "Upload failed": "Title of the notification displayed when upload fails.", - "Image toolbar": "The label describing an image toolbar attached to an image widget used by assistive technologies." + "Image toolbar": "The label used by assistive technologies describing an image toolbar attached to an image widget." }