Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numbered list items get reversed when using backspace key #2721

Closed
lkues opened this issue Jan 3, 2019 · 3 comments
Closed

Numbered list items get reversed when using backspace key #2721

lkues opened this issue Jan 3, 2019 · 3 comments
Assignees
Labels
plugin:list The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. support:1 An issue reported by a commercially licensed client. target:minor Any docs related issue that can be merged into a master or major branch. type:bug A bug.
Milestone

Comments

@lkues
Copy link

lkues commented Jan 3, 2019

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. Go to https://ckeditor.com/ckeditor-4/demo/
  2. Create an indented numbered list as follows:

image

  1. Place the cursor at the end of testb. Press backspace until testa and testb items are deleted.

Expected result

1. Test
    1. apples
    2. oranges
    3. pears
    4. lemons 

Actual result

1. Test
    1. lemons
    2. pears 
    3. oranges
    4. apples

Other details

  • Browser: Chrome
  • OS: Windows 7
  • CKEditor version: 4.x
@engineering-this engineering-this self-assigned this Jan 4, 2019
@engineering-this engineering-this added type:bug A bug. status:confirmed An issue confirmed by the development team. plugin:list The plugin which probably causes the issue. labels Jan 4, 2019
@engineering-this
Copy link
Contributor

Reproduced on both master and major branch.
jan-04-2019 16-31-38

@engineering-this
Copy link
Contributor

engineering-this commented Jan 4, 2019

The culprit:

https://github.com/ckeditor/ckeditor-dev/blob/51f2933d32ff606c85db0aaf7045706c3ebf077a/plugins/list/plugin.js#L527-L537

Depending on forward param items are placed after or before refNode. If forward is falsy items will be iterated from last, and each one is inserted after refNode.

So we have two cases

  1. forward==true
  • Take first item, place after refNode.
  • Take second item, place after refNode which is before first item, order is reversed.
  1. forward==true
  • Take last item, place before refNode.
  • Take n-1 item, place before refNode which is after last item, order is reversed.

Solution is to update refNode to match last inserted child.

@lslowikowska lslowikowska added the support:3 An issue reported by a commercially licensed client. label Jan 18, 2019
@mlewand mlewand added this to the 4.11.3 milestone Jan 25, 2019
@Comandeer
Copy link
Member

Merged into 4.11.3.

@mlewand mlewand added the target:minor Any docs related issue that can be merged into a master or major branch. label Jan 28, 2019
@lslowikowska lslowikowska added support:1 An issue reported by a commercially licensed client. and removed support:3 An issue reported by a commercially licensed client. labels Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin:list The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. support:1 An issue reported by a commercially licensed client. target:minor Any docs related issue that can be merged into a master or major branch. type:bug A bug.
Projects
None yet
Development

No branches or pull requests

5 participants