Skip to content

Commit

Permalink
Avoid scrolling on Chrome when opening dropdowns.
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Oct 7, 2013
1 parent 3a780a0 commit 61f7511
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 6 additions & 0 deletions plugins/floatpanel/plugin.js
Expand Up @@ -364,12 +364,18 @@ CKEDITOR.plugins.add( 'floatpanel', {
panel.isLoaded ? panelLoad() : panel.onLoad = panelLoad;

CKEDITOR.tools.setTimeout( function() {
var scrollTop = CKEDITOR.document.getWindow().getScrollPosition().y;

// Focus the panel frame first, so blur gets fired.
this.focus();

// Focus the block now.
block.element.focus();

// #10623, #10951 - restore the viewport's scroll position after focusing list element.
if ( CKEDITOR.env.webkit )
CKEDITOR.document.getBody().$.scrollTop = scrollTop;

// We need this get fired manually because of unfired focus() function.
this.allowBlur( true );
this._.editor.fire( 'panelShow', this );
Expand Down
9 changes: 1 addition & 8 deletions plugins/listblock/plugin.js
Expand Up @@ -223,16 +223,9 @@ CKEDITOR.plugins.add( 'listblock', {
}
}
}
else {
var scrollTop = CKEDITOR.document.getWindow().getScrollPosition().y;

else
this.element.focus();

// #10623 - restore the viewport's scroll position after focusing list element.
if ( CKEDITOR.env.webkit )
CKEDITOR.document[ CKEDITOR.env.webkit ? 'getBody' : 'getDocumentElement' ]().$.scrollTop = scrollTop;
}

selected && setTimeout( function() {
selected.focus();
}, 0 );
Expand Down

0 comments on commit 61f7511

Please sign in to comment.