X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fbutton%2Fplugin.js;h=b211a28c08c792ebd513f3ca0f6926b3d4d0b92d;hp=b1dca98038cc122135b09fe8143728c08842032f;hb=059b4c2fef02528bf1af189f7996e80652faddfb;hpb=c6e377a02b54abc07129d72b632763c727476a15 diff --git a/_source/plugins/button/plugin.js b/_source/plugins/button/plugin.js index b1dca98..b211a28 100644 --- a/_source/plugins/button/plugin.js +++ b/_source/plugins/button/plugin.js @@ -134,10 +134,14 @@ CKEDITOR.ui.button.prototype = output.push( '', '= 10900 && !env.hc ? '' : '" href="javascript:void(\''+ ( this.title || '' ).replace( "'"+ '' )+ '\')"', ' title="', this.title, '"' + ' tabindex="-1"' + - ' hidefocus="true"' ); + ' hidefocus="true"' + + ' role="button"' + + ' aria-labelledby="' + id + '_label"' + + ( this.hasArrow ? ' aria-haspopup="true"' : '' ) ); // Some browsers don't cancel key events in the keydown but in the // keypress. @@ -170,7 +174,7 @@ CKEDITOR.ui.button.prototype = output.push( '>' + - '', this.label, '' ); + '', this.label, '' ); if ( this.hasArrow ) { @@ -191,25 +195,27 @@ CKEDITOR.ui.button.prototype = setState : function( state ) { if ( this._.state == state ) - return; + return false; + + this._.state = state; var element = CKEDITOR.document.getById( this._.id ); if ( element ) { element.setState( state ); + state == CKEDITOR.TRISTATE_DISABLED ? + element.setAttribute( 'aria-disabled', true ) : + element.removeAttribute( 'aria-disabled' ); - var htmlTitle = this.title, - unavailable = this._.editor.lang.common.unavailable, - labelElement = element.getChild( 1 ); - - if ( state == CKEDITOR.TRISTATE_DISABLED ) - htmlTitle = unavailable.replace( '%1', this.title ); + state == CKEDITOR.TRISTATE_ON ? + element.setAttribute( 'aria-pressed', true ) : + element.removeAttribute( 'aria-pressed' ); - labelElement.setHtml( htmlTitle ); + return true; } - - this._.state = state; + else + return false; } };