diff --git a/CHANGES.md b/CHANGES.md
index 18227415a84..f832982b514 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -3,6 +3,10 @@
## CKEditor 4.11.3
+Fixed Issues:
+
+* [#2721](https://github.com/ckeditor/ckeditor-dev/issues/2721): Fixed: Sublist items are reversed when higher level list item is removed.
+
## CKEditor 4.11.2
Fixed Issues:
diff --git a/plugins/list/plugin.js b/plugins/list/plugin.js
index f31c633b61d..3ab817f5c88 100755
--- a/plugins/list/plugin.js
+++ b/plugins/list/plugin.js
@@ -533,6 +533,7 @@
child.remove();
refNode ? child[ forward ? 'insertBefore' : 'insertAfter' ]( refNode ) : into.append( child, forward );
+ refNode = child;
}
}
diff --git a/tests/plugins/list/list.js b/tests/plugins/list/list.js
index c3839840f81..bc0e54b7d97 100644
--- a/tests/plugins/list/list.js
+++ b/tests/plugins/list/list.js
@@ -212,5 +212,18 @@ bender.test( {
bot.setHtmlWithSelection( '
' );
var bList = ed.getCommand( 'bulletedlist' );
assert.areSame( CKEDITOR.TRISTATE_OFF, bList.state, 'check numbered list inactive' );
+ },
+
+ // #2721
+ 'test sublist order after removing higher order sublist': function() {
+ var bot = this.editorBots.editor1,
+ editor = bot.editor;
+
+ bot.setHtmlWithSelection( '- test
- ^
- a
- b
- c
' );
+ editor.fire( 'key', {
+ domEvent: new CKEDITOR.dom.event( { keyCode: 8 } )
+ } );
+
+ assert.areSame( '- test
- a
- b
- c
', bender.tools.compatHtml( editor.getData() ) );
}
} );
diff --git a/tests/plugins/list/manual/sublistreverse.html b/tests/plugins/list/manual/sublistreverse.html
new file mode 100644
index 00000000000..e6be6a9dc73
--- /dev/null
+++ b/tests/plugins/list/manual/sublistreverse.html
@@ -0,0 +1,23 @@
+
+
+
diff --git a/tests/plugins/list/manual/sublistreverse.md b/tests/plugins/list/manual/sublistreverse.md
new file mode 100644
index 00000000000..850f97f83ae
--- /dev/null
+++ b/tests/plugins/list/manual/sublistreverse.md
@@ -0,0 +1,32 @@
+@bender-tags: bug, 2721, 4.11.3
+@bender-ui: collapsed
+@bender-ckeditor-plugins: wysiwygarea, toolbar, list, sourcearea, undo, elementspath
+
+1. Place caret in list after dollar symbol (`$`).
+1. Press Backspace two times (once in IE).
+
+## Expected
+
+Sublist is ordered alphabetically:
+
+```
+1. Test
+ 1. a
+ 2. b
+ 3. c
+```
+
+## Unexpected
+
+Sublist order is reversed:
+
+```
+1. Test
+ 1. c
+ 2. b
+ 3. a
+```
+
+## Note
+
+There is known upstream issue on IE [#2774](https://github.com/ckeditor/ckeditor-dev/issues/2774) when after pressing Backspace only `li` element is removed and `ol` is preserved. This results in incorrect markup `ol > li > ol > ol > li`.