Ticket #5190: 5190.patch

File 5190.patch, 2.2 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/templates/dialogs/templates.js

     
    100100                        function keyNavigation( evt )
    101101                        {
    102102                                var target = evt.data.getTarget(),
    103                                         position = listContainer.getPosition( target );
     103                                                onList = listContainer.equals( target );
    104104
    105105                                // Keyboard navigation for template list.
    106                                 if ( position > CKEDITOR.POSITION_CONTAINS )
     106                                if (  onList || listContainer.contains( target ) )
    107107                                {
    108108                                        var keystroke = evt.data.getKeystroke(),
    109109                                                items = listContainer.getElementsByTag( 'a' ),
     
    111111
    112112                                        if ( items )
    113113                                        {
    114                                                 switch ( keystroke )
    115                                                 {
    116                                                         case 40 :                                       // ARROW-DOWN
    117                                                                 focusItem = target.getNext();
    118                                                                 break;
     114                                                // Focus not yet onto list items?
     115                                                if ( onList )
     116                                                        focusItem = items.getItem( 0 );
     117                                                else
     118                                                {
     119                                                        switch ( keystroke )
     120                                                        {
     121                                                                case 40 :                                       // ARROW-DOWN
     122                                                                        focusItem = target.getNext();
     123                                                                        break;
    119124
    120                                                         case 38 :                                       // ARROW-UP
    121                                                                 focusItem = target.getPrevious();
    122                                                                 break;
     125                                                                case 38 :                                       // ARROW-UP
     126                                                                        focusItem = target.getPrevious();
     127                                                                        break;
    123128
    124                                                         case 13 :                                       // ENTER
    125                                                         case 32 :                                       // SPACE
    126                                                                 target.fire( 'click' );
    127                                                 }
     129                                                                case 13 :                                       // ENTER
     130                                                                case 32 :                                       // SPACE
     131                                                                        target.fire( 'click' );
     132                                                        }
     133                                                }
    128134
    129135                                                if ( focusItem )
    130136                                                {
     
    168174                                                                        {
    169175                                                                                id : "templatesList",
    170176                                                                                type : 'html',
    171                                                                                 focus: function()
    172                                                                                 {
    173                                                                                         // Move focus to the first list item if available.
    174                                                                                         try { this.getElement().getElementsByTag( 'a' ).getItem( 0 ).focus(); }
    175                                                                                         catch( er ){}
    176                                                                                 },
     177                                                                                focus: true,
    177178                                                                                html :
    178179                                                                                        '<div class="cke_tpl_list" tabIndex="-1" role="listbox" aria-labelledby="cke_tpl_list_label">' +
    179180                                                                                                '<div class="cke_tpl_loading"><span></span></div>' +
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy