Ticket #3417: 3417_4.patch

File 3417_4.patch, 2.9 KB (added by Martin Kou, 15 years ago)
  • _source/plugins/screenreader/plugin.js

     
     1/*
     2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6/**
     7 * @fileOverview Interface to announce voice messages to screenreaders for ARIA-
     8 *              compliant browsers.
     9 */
     10
     11CKEDITOR.plugins.add( 'screenreader',
     12{
     13        init : function( editor )
     14        {
     15                editor.on( 'themeSpace', function( evt )
     16                        {
     17                                if ( evt.data.space != 'top' )
     18                                        return;
     19
     20                                evt.data.html += '<ul style="position:absolute;left:-10000px;list-style-type:none;"' +
     21                                        ' role="log" aria-live="rude" aria-relevant="additions" aria-atomic="false"' +
     22                                        ' id="cke_screenreader_' + editor.name + '"></ul>';
     23                        } );
     24        }
     25} );
     26
     27CKEDITOR.editor.prototype.announce = function( text )
     28{
     29        var item = CKEDITOR.dom.element.createFromHtml( '<li>' + CKEDITOR.tools.htmlEncode( text ) + '</li>' );
     30        CKEDITOR.document.getById( 'cke_screenreader_' + this.name ).append( item );
     31};
  • _source/plugins/button/plugin.js

     
    130130                                ' class="', classes, '" href="javascript:void(\'', ( this.title || '' ).replace( "'", '' ), '\')"' +
    131131                                ' title="', this.title, '"' +
    132132                                ' tabindex="-1"' +
     133                                ' role="button"' +
    133134                                ' hidefocus="true"' );
    134135
    135136                // Some browsers don't cancel key events in the keydown but in the
  • _source/plugins/toolbar/plugin.js

     
    1010
    1111(function()
    1212{
    13         var toolbox = function()
     13        var toolbox = function( editor )
    1414        {
     15                this.editor = editor;
    1516                this.toolbars = [];
    1617                this.focusCommandExecuted = false;
    1718        };
     
    2425                        {
    2526                                if ( item.focus )
    2627                                {
     28                                        // If Firefox, announce the item's text separately. (#3417)
     29                                        if ( CKEDITOR.env.gecko )
     30                                                this.editor.announce( item.button.label );
     31
    2732                                        item.focus();
    2833                                        return;
    2934                                }
     
    5560
    5661        CKEDITOR.plugins.add( 'toolbar',
    5762        {
     63                requires : [ 'screenreader' ],
     64
    5865                init : function( editor )
    5966                {
    6067                        var itemKeystroke = function( item, keystroke )
     
    110117                                {
    111118                                        if ( event.data.space == editor.config.toolbarLocation )
    112119                                        {
    113                                                 editor.toolbox = new toolbox();
     120                                                editor.toolbox = new toolbox( editor );
    114121
    115122                                                var output = [ '<div class="cke_toolbox"' ],
    116123                                                        expanded =  editor.config.toolbarStartupExpanded,
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy