Index: _source/plugins/templates/dialogs/templates.js =================================================================== --- _source/plugins/templates/dialogs/templates.js (revision 5239) +++ _source/plugins/templates/dialogs/templates.js Fri Mar 19 13:51:22 CST 2010 @@ -100,10 +100,10 @@ function keyNavigation( evt ) { var target = evt.data.getTarget(), - position = listContainer.getPosition( target ); + onList = listContainer.equals( target ); // Keyboard navigation for template list. - if ( position > CKEDITOR.POSITION_CONTAINS ) + if ( onList || listContainer.contains( target ) ) { var keystroke = evt.data.getKeystroke(), items = listContainer.getElementsByTag( 'a' ), @@ -111,20 +111,26 @@ if ( items ) { + // Focus not yet onto list items? + if ( onList ) + focusItem = items.getItem( 0 ); + else + { - switch ( keystroke ) - { - case 40 : // ARROW-DOWN - focusItem = target.getNext(); - break; + switch ( keystroke ) + { + case 40 : // ARROW-DOWN + focusItem = target.getNext(); + break; - case 38 : // ARROW-UP - focusItem = target.getPrevious(); - break; + case 38 : // ARROW-UP + focusItem = target.getPrevious(); + break; - case 13 : // ENTER - case 32 : // SPACE - target.fire( 'click' ); - } + case 13 : // ENTER + case 32 : // SPACE + target.fire( 'click' ); + } + } if ( focusItem ) { @@ -168,12 +174,7 @@ { id : "templatesList", type : 'html', - focus: function() - { - // Move focus to the first list item if available. - try { this.getElement().getElementsByTag( 'a' ).getItem( 0 ).focus(); } - catch( er ){} - }, + focus: true, html : '