Skip to content

Commit

Permalink
Set the focus to the list holder element when opening a toolbar combo.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredck authored and oleq committed May 29, 2013
1 parent 70fbb8d commit d0f600e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
21 changes: 12 additions & 9 deletions plugins/listblock/plugin.js
Expand Up @@ -205,24 +205,27 @@ CKEDITOR.plugins.add( 'listblock', {
focus: function( value ) {
this._.focusIndex = -1;

if ( value ) {
var selected = this.element.getDocument().getById( this._.items[ value ] ).getFirst();
var links = this.element.getElementsByTag( 'a' ),
link,
selected,
i = -1;

var links = this.element.getElementsByTag( 'a' ),
link,
i = -1;
if ( value ) {
selected = this.element.getDocument().getById( this._.items[ value ] ).getFirst();

while ( ( link = links.getItem( ++i ) ) ) {
if ( link.equals( selected ) ) {
this._.focusIndex = i;
break;
}
}

setTimeout( function() {
selected.focus();
}, 0 );
} else {
this.element.focus();
}

selected && setTimeout( function() {
selected.focus();
}, 0 );
}
}
});
Expand Down
3 changes: 2 additions & 1 deletion plugins/panel/plugin.js
Expand Up @@ -267,7 +267,8 @@
attributes: {
'tabIndex': -1,
'class': 'cke_panel_block',
'role': 'presentation'
'role': 'presentation',
'tabindex': 0
},
styles: {
display: 'none'
Expand Down
4 changes: 2 additions & 2 deletions plugins/richcombo/plugin.js
Expand Up @@ -249,14 +249,14 @@ CKEDITOR.plugins.add( 'richcombo', {

me.setState( CKEDITOR.TRISTATE_ON );

list.focus( !list.multiSelect && me.getValue() );

me._.on = 1;

me.editorFocus && editor.focus();

if ( me.onOpen )
me.onOpen();

list.focus( !list.multiSelect && me.getValue() );
};

panel.onHide = function( preventOnClose ) {
Expand Down

0 comments on commit d0f600e

Please sign in to comment.