8
0
Quellcode durchsuchen

Update way how aria-label is added for toolbars in dropdown.

Mateusz Samsel vor 6 Jahren
Ursprung
Commit
f7e0720e27

+ 1 - 1
packages/ckeditor5-ui/lang/contexts.json

@@ -6,5 +6,5 @@
 	"Previous": "Label for a button showing the previous thing (tab, page, etc.).",
 	"%0 of %1": "Label for a 'page X of Y' status of a typical next/previous page navigation.",
 	"Editor toolbar": "Label describing the main editor toolbar used by assistive technologies.",
-	"Dropdown's toolbar": "Label describing the toolbar under a dropdown button used by assistive technologies."
+	"Dropdown toolbar": "Label describing the toolbar under a dropdown button used by assistive technologies."
 }

+ 3 - 1
packages/ckeditor5-ui/src/dropdown/utils.js

@@ -131,7 +131,9 @@ export function createDropdown( locale, ButtonClass = DropdownButtonView ) {
 export function addToolbarToDropdown( dropdownView, buttons ) {
 	const locale = dropdownView.locale;
 	const t = locale.t;
-	const toolbarView = dropdownView.toolbarView = new ToolbarView( locale, { ariaLabel: t( 'Dropdown\'s toolbar' ) } );
+	const toolbarView = dropdownView.toolbarView = new ToolbarView( locale );
+
+	toolbarView.set( 'ariaLabel', t( 'Dropdown toolbar' ) );
 
 	dropdownView.extendTemplate( {
 		attributes: {

+ 4 - 0
packages/ckeditor5-ui/tests/dropdown/utils.js

@@ -272,6 +272,10 @@ describe( 'utils', () => {
 			expect( dropdownView.element.classList.contains( 'ck-toolbar-dropdown' ) ).to.be.true;
 		} );
 
+		it( 'sets aria-label', () => {
+			expect( dropdownView.toolbarView.element.getAttribute( 'aria-label' ) ).to.equal( 'Dropdown toolbar' );
+		} );
+
 		describe( 'view#toolbarView', () => {
 			it( 'is created', () => {
 				const panelChildren = dropdownView.panelView.children;