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

Add aria-label for media embed toolbar #88

Merged
merged 3 commits into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lang/contexts.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"Tip: Paste the URL into the content to embed faster.": "The tip displayed next to the media URL input informing about an easier way of embedding.",
"The URL must not be empty.": "An error message that informs about an empty value in the URL input.",
"This media URL is not supported.": "An error message that informs about unsupported media URL.",
"Insert media": "Toolbar button tooltip for the Media Embed feature."
"Insert media": "Toolbar button tooltip for the Media Embed feature.",
"Media toolbar": "The label used by assistive technologies describing an image toolbar attached to an image widget."
}
2 changes: 2 additions & 0 deletions src/mediaembedtoolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ export default class MediaEmbedToolbar extends Plugin {
*/
afterInit() {
const editor = this.editor;
const t = editor.t;
const widgetToolbarRepository = editor.plugins.get( WidgetToolbarRepository );

widgetToolbarRepository.register( 'mediaEmbed', {
ariaLabel: t( 'Media toolbar' ),
items: editor.config.get( 'mediaEmbed.toolbar' ) || [],
getRelatedElement: getSelectedMediaViewWidget,
} );
Expand Down
8 changes: 8 additions & 0 deletions tests/mediaembedtoolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ describe( 'MediaEmbedToolbar', () => {
balloonClassName: 'ck-toolbar-container'
} );
} );

it( 'should set aria-label attribute', () => {
toolbar.render();

expect( toolbar.element.getAttribute( 'aria-label' ) ).to.equal( 'Media toolbar' );

toolbar.destroy();
} );
} );

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