Skip to content
Permalink
Browse files

Merge branch 't/14894' into major

  • Loading branch information...
Comandeer committed Feb 7, 2017
2 parents f8d2136 + 3177361 commit af78e85b360a5d774233369641a99052c2623192
@@ -17,6 +17,7 @@ Fixed Issues:
* [#11956](http://dev.ckeditor.com/ticket/11956): [Blink, IE] Fixed: [Link](http://ckeditor.com/addon/link) dialog does not open on a double click on the second word of the link with background color or other styles.
* [#10472](http://dev.ckeditor.com/ticket/10472): Fixed: Unable to use [Table Resize](http://ckeditor.com/addon/tableresize) on table's header and footer.
* [#16777](https://dev.ckeditor.com/ticket/16777): [Edge] Fixed: [Clipboard](http://ckeditor.com/addon/clipboard) plugin doesn't allow to drop widgets into editor.
* [#14894](https://dev.ckeditor.com/ticket/14894): [Chrome] Fixed: Editor scrolls to top after focusing or when a dialog is opened.

## CKEditor 4.6.2

@@ -87,7 +87,15 @@
if ( CKEDITOR.env.ie && !( CKEDITOR.env.edge && CKEDITOR.env.version > 14 ) && this.getDocument().equals( CKEDITOR.document ) ) {
this.$.setActive();
} else {
this.$.focus();
// We have no control over exactly what happens when the native `focus` method is called,
// so save the scroll position and restore it later.
if ( CKEDITOR.env.chrome ) {
var scrollPos = this.$.scrollTop;
this.$.focus();
this.$.scrollTop = scrollPos;
} else {
this.$.focus();
}
}
} catch ( e ) {
// IE throws unspecified error when focusing editable after closing dialog opened on nested editable.
@@ -0,0 +1,55 @@
<textarea name="editor1">
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
</textarea>
<hr />
<textarea name="editor2">
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
</textarea>
<script type="text/javascript">
if ( !CKEDITOR.env.chrome ) {
bender.ignore();
}
CKEDITOR.replace( 'editor1' );
CKEDITOR.replace( 'editor2' );
</script>
@@ -0,0 +1,17 @@
@bender-tags: 4.7.0, tc, 14894
@bender-ui: collapsed
@bender-ckeditor-plugins: clipboard, contextmenu, toolbar, wysiwygarea, link

## Test scenario

For each editor:
1. Scroll it without focusing.
2. Open the link dialog.

## Expected result

Scroll position remains unchanged.

## Unexpected

Editor scroll position is moved to top.
@@ -9,6 +9,13 @@ bender.editors = {
config: {
allowedContent: true
}
},
scrollable: {
name: 'editor2',
creator: 'replace',
config: {
height: 300
}
}
};

@@ -96,5 +103,27 @@ bender.test( {

assert.areSame( 'foo', editor.getSelection().getSelectedText(), 'Selection has not been changed' );
} );
},

'test scroll editable and focus': function() {
if ( !CKEDITOR.env.chrome ) {
assert.ignore();
}

var bot = this.editorBots.scrollable,
editable = this.editors.scrollable.editable();

bot.setData( '<p>Test</p><p>Test</p><p>Test</p><p>Test</p>' +
'<p>Test</p><p>Test</p><p>Test</p><p>Test</p>' +
'<p>Test</p><p>Test</p><p>Test</p><p>Test</p>' +
'<p>Test</p><p>Test</p><p>Test</p><p>Test</p>' +
'<p>Test</p><p>Test</p><p>Test</p><p>Test</p>', function() {
var scrollPos = 100;

editable.$.scrollTop = scrollPos;
editable.focus();

assert.areSame( scrollPos, editable.$.scrollTop );
} );
}
} );
} );

0 comments on commit af78e85

Please sign in to comment.
You can’t perform that action at this time.