Opened 9 years ago
Last modified 8 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
- Open Placeholder demo
- Select all text, delete it
- Type 'Testing '
- click placeholder button
- hit right arrow, as placeholder is selected (boo)
- hit Enter
- type a letter
- press left arrow key
- 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:1 Changed 9 years ago by
comment:2 Changed 9 years ago by
Keywords: | widget backspace removed |
---|---|
Status: | new → confirmed |
Version: | 4.5.3 → 4.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 9 years ago by
In Android it is not possible to delete widget (using android keyboard) even after selecing it.
comment:4 Changed 8 years ago by
Milestone: | → CKEditor 4.6.0 |
---|
comment:5 Changed 8 years ago by
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 8 years ago by
Milestone: | CKEditor 4.6.0 → CKEditor 4.6.1 |
---|
comment:7 Changed 8 years ago by
Milestone: | CKEditor 4.6.1 → CKEditor 4.6.2 |
---|
comment:8 Changed 8 years ago by
Milestone: | CKEditor 4.6.2 → CKEditor 4.7.0 |
---|
comment:9 Changed 8 years ago by
Owner: | set to Tade0 |
---|---|
Status: | confirmed → assigned |
comment:10 Changed 8 years ago by
I have a working implementation, but so far the unit tests I created behave differently than the manual test.
Investigating.
comment:11 Changed 8 years ago by
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 8 years ago by
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 8 years ago by
Milestone: | CKEditor 4.7.0 |
---|---|
Priority: | Normal → Nice to have (we want to work on it) |
Submitted PR: https://github.com/ckeditor/ckeditor-dev/pull/211