Opened 13 years ago
Closed 12 years ago
#10055 closed Bug (fixed)
CKEditor backspace IE - When selecting a image and pressing "backspace" causes browser to go back
| Reported by: | Roy Shoa | Owned by: | Piotrek Koszuliński |
|---|---|---|---|
| Priority: | Normal | Milestone: | CKEditor 4.3.1 |
| Component: | General | Version: | 4.0 |
| Keywords: | IE IBM | Cc: | mmgagnon@…, jean-francois.fournier@…, satya_minnekanti@…, mike@… |
Description
Hi, When selecting a image and pressing "backspace" causes browser to go back instead of removing the image.
Steps to Reproduce
- Open IE9 browser.
- Go to "http://ckeditor.com/demo".
- Select the image on in the editor by clicking on it.
- Press "backspace".
Expected Result
The image need to be removed.
Actual Result
browser to go back.
Change History (15)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
| Keywords: | backspace remove image removed |
|---|---|
| Status: | new → confirmed |
| Version: | 4.0.1 → 4.0 |
This problem can be reproduced in IE7-10 from CKEditor 4.0. It doesn't occur in CKE 4 beta and CKE 3.x (it was fixed with #4047).
comment:3 Changed 12 years ago by
| Cc: | mmgagnon@… added |
|---|---|
| Version: | 4.0 → 4.1.1 |
This bug can still be reproduced with ckEditor 4.1.x, and occurs in both Internet Explorer 9 and 10.
comment:4 Changed 12 years ago by
This is not the cleanest solution ever, but in case this can help anyone facing this issue, here is the best workaround I could come up with until a proper solution is found. This does not currently work for inline editing but can likely be adapted without too much trouble
/** Work around Internet Explorer bug : the backspace key is interpreted as a keyboard shortcut to navigate back */
function preventBackspaceFromNavigatingInCkEditor(ckId)
{
var iframe = $('#cke_' + ckId + ' .cke_wysiwyg_frame');
$(iframe[0].contentWindow.document).keydown(function (e)
{
var preventKeyPress;
if (e.keyCode == 8)
{
var range = CKEDITOR.instances[ckId].getSelection().getRanges()[0];
if (range == null) return;
var node = range.getEnclosedNode();
if (node == null) return;
if (node.$ != null)
{
var nodeName = node.$.tagName.toUpperCase();
if (nodeName == "IMG" || nodeName == "TABLE" || nodeName == "A")
{
preventKeyPress = true;
// erase selection
range.deleteContents();
range.select();
}
}
}
else
preventKeyPress = false;
if (preventKeyPress)
e.preventDefault();
});
}
comment:5 Changed 12 years ago by
| Version: | 4.1.1 → 4.0 |
|---|
@mmgagnon version is used to indicate when problem stared occurring. Don't change it!!!
comment:6 Changed 12 years ago by
| Cc: | jean-francois.fournier@… added |
|---|
#10313 was marked as duplicate.
comment:7 Changed 12 years ago by
| Cc: | satya_minnekanti@… added |
|---|---|
| Keywords: | IBM added |
comment:9 Changed 12 years ago by
| Owner: | set to Piotrek Koszuliński |
|---|---|
| Status: | confirmed → assigned |
comment:11 Changed 12 years ago by
| Status: | assigned → review |
|---|
Pushed t/10055 which re enable custom image/anchor/etc delete code. I decided to cover only browsers affected by this bug.
The code which removes selected element is poor - it loses selection or places it between blocks or does not autoparagraph (usually in case of table/list selection). There's similar code which handles widgets and it works better, but it's not perfect too. So, since we're planning to rewrite all backspace/delete handling, I'm not touching that part.
comment:14 Changed 12 years ago by
| Milestone: | → CKEditor 4.3.1 |
|---|---|
| Status: | review → review_passed |
comment:15 Changed 12 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | review_passed → closed |
Fixed on master with git:a1baa1d.

I am getting the same result in IE8.