Skip to content

Commit 16b11f4

Browse files
committed
Merge branch 't/11044'
2 parents d555b5e + caac891 commit 16b11f4

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CKEditor 4 Changelog
99

1010
Fixed Issues:
1111

12+
* [#11044](http://dev.ckeditor.com/ticket/11044): Enhanced aria support for language plugin drop-down menu.
1213
* [#11075](http://dev.ckeditor.com/ticket/11075): With drop-down menubutton focused, pressing down arrow key will now open menu and focus its first option.
1314
* [#11165](http://dev.ckeditor.com/ticket/11165): The filebrowser plugin cannot be removed from the editor.
1415
* [#11171](http://dev.ckeditor.com/ticket/11171): Fixed: [`editor.insertElement`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-insertElement) and [`editor.insertText`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-insertText) methods do not call the [`widget.repository.checkWidgets`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.repository-method-checkWidgets) method.

plugins/language/plugin.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
ltr: ( '' + parts[ 2 ] ).toLowerCase() != 'rtl',
6363
onClick: function() {
6464
editor.execCommand( 'language', this.langId );
65-
}
65+
},
66+
role: 'menuitemcheckbox'
6667
};
6768

6869
// Init style property.

plugins/menu/plugin.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ CKEDITOR.plugins.add( 'menu', {
8787
' tabindex="-1"' +
8888
'_cke_focus=1' +
8989
' hidefocus="true"' +
90-
' role="menuitem"' +
90+
' role="{role}"' +
9191
' aria-haspopup="{hasPopup}"' +
92-
' aria-disabled="{disabled}"';
92+
' aria-disabled="{disabled}"' +
93+
' {ariaChecked}';
9394

9495
// Some browsers don't cancel key events in the keydown but in the
9596
// keypress.
@@ -460,10 +461,14 @@ CKEDITOR.plugins.add( 'menu', {
460461
proto: {
461462
render: function( menu, index, output ) {
462463
var id = menu.id + String( index ),
463-
state = ( typeof this.state == 'undefined' ) ? CKEDITOR.TRISTATE_OFF : this.state;
464+
state = ( typeof this.state == 'undefined' ) ? CKEDITOR.TRISTATE_OFF : this.state,
465+
ariaChecked = '';
464466

465467
var stateName = state == CKEDITOR.TRISTATE_ON ? 'on' : state == CKEDITOR.TRISTATE_DISABLED ? 'disabled' : 'off';
466468

469+
if ( this.role in { menuitemcheckbox: 1, menuitemradio: 1 } )
470+
ariaChecked = ' aria-checked="' + ( state == CKEDITOR.TRISTATE_ON ? 'true' : 'false' ) + '"';
471+
467472
var hasSubMenu = this.getItems;
468473
// ltr: BLACK LEFT-POINTING POINTER
469474
// rtl: BLACK RIGHT-POINTING POINTER
@@ -489,7 +494,9 @@ CKEDITOR.plugins.add( 'menu', {
489494
clickFn: menu._.itemClickFn,
490495
index: index,
491496
iconStyle: CKEDITOR.skin.getIconStyle( iconName, ( this.editor.lang.dir == 'rtl' ), iconName == this.icon ? null : this.icon, this.iconOffset ),
492-
arrowHtml: hasSubMenu ? menuArrowTpl.output({ label: arrowLabel } ) : ''
497+
arrowHtml: hasSubMenu ? menuArrowTpl.output( { label : arrowLabel } ) : '',
498+
role: this.role ? this.role : 'menuitem',
499+
ariaChecked: ariaChecked
493500
};
494501

495502
menuItemTpl.output( params, output );

0 commit comments

Comments
 (0)