Opened 4 years ago

Last modified 2 years ago

#13703 assigned Bug

Pressing backspace near (but not next to) widget selects it.

Reported by: Dusty Jewett Owned by: Tade0
Priority: Nice to have (we want to work on it) Milestone:
Component: Core : Selection Version: 4.3
Keywords: Support Cc:

Description

Steps to reproduce

  1. Open Placeholder demo
  2. Select all text, delete it
  3. Type 'Testing '
  4. click placeholder button
  5. hit right arrow, as placeholder is selected (boo)
  6. hit Enter
  7. type a letter
  8. press left arrow key
  9. press backspace

Expected result

Paragraphs are merged together, as they are when no widget is present

Actual result

Widget is selected, paragraphs don't change.

Other details (browser, OS, CKEditor version, installed plugins)

4.5.x, Chrome

Investigation

The issue happens inside of selection.js#getOnKeyDownListener, where it checks for getPreviousEditableNode. It finds the widget, but assumes that the backspace key would have deleted the widget. Instead, it should check if the text and widget are adjacent, maybe with next.getParent().contains(range.startContainer)?

Change History (13)

comment:2 Changed 4 years ago by Piotrek Koszuliński

Keywords: widget backspace removed
Status: newconfirmed
Version: 4.5.34.3

It would make sense for the delete and backspace to remove a line break instead of moving the selection to the widget. However, that's a lot of work as the number of cases is pretty big.

comment:3 Changed 3 years ago by Jakub Ś

In Android it is not possible to delete widget (using android keyboard) even after selecing it.

comment:4 Changed 3 years ago by Marek Lewandowski

Milestone: CKEditor 4.6.0

comment:5 Changed 3 years ago by Jakub Ś

Keywords: Support added

This issue has been reported on our support channel.

There are other TCs:

  • Go to: http://ckeditor.com/demo#widgets
  • Empty first paragraph, when there is no content in that paragraph, try deleting it by pressing delete. Same bug exists with backspace for paragraph after widget.

Actual Result: Empty paragraph won't be deleted. Instead widget is focused.
Expected Result: Paragraph will be deleted AND widget will be focused.

This also means that paragraph between two widgets cannot be removed at all without source editing.

comment:6 Changed 3 years ago by Marek Lewandowski

Milestone: CKEditor 4.6.0CKEditor 4.6.1

comment:7 Changed 2 years ago by Marek Lewandowski

Milestone: CKEditor 4.6.1CKEditor 4.6.2

comment:8 Changed 2 years ago by Marek Lewandowski

Milestone: CKEditor 4.6.2CKEditor 4.7.0

comment:9 Changed 2 years ago by Tade0

Owner: set to Tade0
Status: confirmedassigned

comment:10 Changed 2 years ago by Tade0

I have a working implementation, but so far the unit tests I created behave differently than the manual test.

Investigating.

comment:11 Changed 2 years ago by Tade0

There's a blocking issue in IE: http://dev.ckeditor.com/ticket/16870#ticket

There's also an issue in Firefox, but it doesn't reproduce on major even though none of the code added in t/13703 is executed when reproducing it.

comment:12 Changed 2 years ago by Tade0

There's a lingering issue in Firefox, namely in the manual test in the second editor(enterMode: CKEDITOR.ENTER_BR) if you place the caret before the "G" and hit backspace the elements in the previous paragraph switch places.

If you add a breakpoint say here: https://github.com/ckeditor/ckeditor-dev/blob/a3b2b66e4403375372875f7834d9ec9539203abd/core/event.js#L285 With the condition eventName == 'blur' && i == 1, the bug will occur after the current tick is over.

This means there's some asynchronous event after that handler and it's probably the one responsible for the bug.

comment:13 Changed 2 years ago by Marek Lewandowski

Milestone: CKEditor 4.7.0
Priority: NormalNice to have (we want to work on it)
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy