From f63dc0579c64e7d7319382fcb423a82eeb33c25a Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Thu, 8 Aug 2019 15:50:15 +0200 Subject: [PATCH 1/3] Add aria label for table toolbar. --- lang/contexts.json | 3 ++- src/tabletoolbar.js | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lang/contexts.json b/lang/contexts.json index f7e7fb00..230b2926 100644 --- a/lang/contexts.json +++ b/lang/contexts.json @@ -16,5 +16,6 @@ "Merge cell left": "Label for the merge table cell left button.", "Split cell vertically": "Label for the split table cell vertically button.", "Split cell horizontally": "Label for the split table cell horizontally button.", - "Merge cells": "Label for the merge table cells button." + "Merge cells": "Label for the merge table cells button.", + "Table toolbar": "The label describing a table toolbar attached to a table widget used by assistive technologies." } diff --git a/src/tabletoolbar.js b/src/tabletoolbar.js index 1e5f25eb..b6fee36a 100644 --- a/src/tabletoolbar.js +++ b/src/tabletoolbar.js @@ -42,6 +42,7 @@ export default class TableToolbar extends Plugin { */ afterInit() { const editor = this.editor; + const t = editor.t; const widgetToolbarRepository = editor.plugins.get( WidgetToolbarRepository ); const tableContentToolbarItems = editor.config.get( 'table.contentToolbar' ); @@ -50,6 +51,7 @@ export default class TableToolbar extends Plugin { if ( tableContentToolbarItems ) { widgetToolbarRepository.register( 'tableContent', { + ariaLabel: t( 'Table toolbar' ), items: tableContentToolbarItems, getRelatedElement: getTableWidgetAncestor } ); @@ -57,6 +59,7 @@ export default class TableToolbar extends Plugin { if ( tableToolbarItems ) { widgetToolbarRepository.register( 'table', { + ariaLabel: t( 'Table toolbar' ), items: tableToolbarItems, getRelatedElement: getSelectedTableWidget } ); From 8e9493943fe4381231306dbbcc8fe50d41d92469 Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Thu, 8 Aug 2019 16:48:30 +0200 Subject: [PATCH 2/3] Add test checking aria-label. --- tests/tabletoolbar.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/tabletoolbar.js b/tests/tabletoolbar.js index 21f90a96..d0a35d14 100644 --- a/tests/tabletoolbar.js +++ b/tests/tabletoolbar.js @@ -94,6 +94,14 @@ describe( 'TableToolbar', () => { balloonClassName: 'ck-toolbar-container' } ); } ); + + it( 'should set aria-label attribute', () => { + toolbar.render(); + + expect( toolbar.element.getAttribute( 'aria-label' ) ).to.equal( 'Table toolbar' ); + + toolbar.destroy(); + } ); } ); describe( 'integration with the editor focus', () => { From d7f9d0fbeae4bf84f0785b27c850910f6a1ecefd Mon Sep 17 00:00:00 2001 From: Aleksander Nowodzinski Date: Tue, 13 Aug 2019 16:42:57 +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 230b2926..b14a6c17 100644 --- a/lang/contexts.json +++ b/lang/contexts.json @@ -17,5 +17,5 @@ "Split cell vertically": "Label for the split table cell vertically button.", "Split cell horizontally": "Label for the split table cell horizontally button.", "Merge cells": "Label for the merge table cells button.", - "Table toolbar": "The label describing a table toolbar attached to a table widget used by assistive technologies." + "Table toolbar": "The label used by assistive technologies describing a table toolbar attached to a table widget." }