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

Commit b47a94f

Browse files
authored
Merge pull request #201 from ckeditor/t/ckeditor5/1404
Other: The table widget toolbar should have a proper `aria-label` attribute (see ckeditor/ckeditor5#1404).
2 parents 8cc3436 + d7f9d0f commit b47a94f

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

lang/contexts.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
"Merge cell left": "Label for the merge table cell left button.",
1717
"Split cell vertically": "Label for the split table cell vertically button.",
1818
"Split cell horizontally": "Label for the split table cell horizontally button.",
19-
"Merge cells": "Label for the merge table cells button."
19+
"Merge cells": "Label for the merge table cells button.",
20+
"Table toolbar": "The label used by assistive technologies describing a table toolbar attached to a table widget."
2021
}

src/tabletoolbar.js

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export default class TableToolbar extends Plugin {
4242
*/
4343
afterInit() {
4444
const editor = this.editor;
45+
const t = editor.t;
4546
const widgetToolbarRepository = editor.plugins.get( WidgetToolbarRepository );
4647

4748
const tableContentToolbarItems = editor.config.get( 'table.contentToolbar' );
@@ -50,13 +51,15 @@ export default class TableToolbar extends Plugin {
5051

5152
if ( tableContentToolbarItems ) {
5253
widgetToolbarRepository.register( 'tableContent', {
54+
ariaLabel: t( 'Table toolbar' ),
5355
items: tableContentToolbarItems,
5456
getRelatedElement: getTableWidgetAncestor
5557
} );
5658
}
5759

5860
if ( tableToolbarItems ) {
5961
widgetToolbarRepository.register( 'table', {
62+
ariaLabel: t( 'Table toolbar' ),
6063
items: tableToolbarItems,
6164
getRelatedElement: getSelectedTableWidget
6265
} );

tests/tabletoolbar.js

+8
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ describe( 'TableToolbar', () => {
9494
balloonClassName: 'ck-toolbar-container'
9595
} );
9696
} );
97+
98+
it( 'should set aria-label attribute', () => {
99+
toolbar.render();
100+
101+
expect( toolbar.element.getAttribute( 'aria-label' ) ).to.equal( 'Table toolbar' );
102+
103+
toolbar.destroy();
104+
} );
97105
} );
98106

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

0 commit comments

Comments
 (0)