JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.2
[ckeditor.git] / _source / plugins / button / plugin.js
index b1dca98..b211a28 100644 (file)
@@ -134,10 +134,14 @@ CKEDITOR.ui.button.prototype =
                output.push(\r
                        '<span class="cke_button">',\r
                        '<a id="', id, '"' +\r
-                               ' class="', classes, '" href="javascript:void(\'', ( this.title || '' ).replace( "'", '' ), '\')"' +\r
+                               ' class="', classes, '"',\r
+                               env.gecko && env.version >= 10900 && !env.hc  ? '' : '" href="javascript:void(\''+ ( this.title || '' ).replace( "'"+ '' )+ '\')"',\r
                                ' title="', this.title, '"' +\r
                                ' tabindex="-1"' +\r
-                               ' hidefocus="true"' );\r
+                               ' hidefocus="true"' +\r
+                           ' role="button"' +\r
+                               ' aria-labelledby="' + id + '_label"' +\r
+                               ( this.hasArrow ?  ' aria-haspopup="true"' : '' ) );\r
 \r
                // Some browsers don't cancel key events in the keydown but in the\r
                // keypress.\r
@@ -170,7 +174,7 @@ CKEDITOR.ui.button.prototype =
 \r
                output.push(\r
                                        '></span>' +\r
-                                       '<span class="cke_label">', this.label, '</span>' );\r
+                                       '<span id="', id, '_label" class="cke_label">', this.label, '</span>' );\r
 \r
                if ( this.hasArrow )\r
                {\r
@@ -191,25 +195,27 @@ CKEDITOR.ui.button.prototype =
        setState : function( state )\r
        {\r
                if ( this._.state == state )\r
-                       return;\r
+                       return false;\r
+\r
+               this._.state = state;\r
 \r
                var element = CKEDITOR.document.getById( this._.id );\r
 \r
                if ( element )\r
                {\r
                        element.setState( state );\r
+                       state == CKEDITOR.TRISTATE_DISABLED ?\r
+                               element.setAttribute( 'aria-disabled', true ) :\r
+                               element.removeAttribute( 'aria-disabled' );\r
 \r
-                       var htmlTitle = this.title,\r
-                               unavailable = this._.editor.lang.common.unavailable,\r
-                               labelElement = element.getChild( 1 );\r
-\r
-                       if ( state == CKEDITOR.TRISTATE_DISABLED )\r
-                               htmlTitle = unavailable.replace( '%1', this.title );\r
+                       state == CKEDITOR.TRISTATE_ON ?\r
+                               element.setAttribute( 'aria-pressed', true ) :\r
+                               element.removeAttribute( 'aria-pressed' );\r
 \r
-                       labelElement.setHtml( htmlTitle );\r
+                       return true;\r
                }\r
-\r
-               this._.state = state;\r
+               else\r
+                       return false;\r
        }\r
 };\r
 \r