Bug 35364 - Delete should not merge past table boundaries
Summary: Delete should not merge past table boundaries
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-24 15:06 PST by Julie Parent
Modified: 2018-03-07 04:52 PST (History)
5 users (show)

See Also:


Attachments
Test case to reproduce the bug (120 bytes, text/html)
2018-03-07 04:52 PST, Javier Fernandez
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julie Parent 2010-02-24 15:06:16 PST
Repro steps:
1. Inside a contentEditable region, select starting inside a table cell, and ending in an inline or block past the table cell.
2. Hit backspace/delete

Result:
Selected contents are deleted, contents of non-selected part of inline/block are merged into the table cell.

Expected Result:
Selected contents are deleted, but the table cell boundary is treated like an editable root, and no merge occurs.  This is what Word, TextEdit, and Firefox all do (IE has very strange behavior - it doesn't even perform a delete of any sort, and just collapses the selection).

webkit only demo (you'll need to hit "eval JS now" button to execute the js that does the select + delete): http://www.plexode.com/cgi-bin/eval3.py#ht=%3Cdiv%20contentEditable%20id%3D'edit'%3E%3Ctable%20id%3D'table'%20border%3D1%3E%3Ctr%3E%3Ctd%3E1%3C%2Ftd%3E%3Ctd%3E2%3C%2Ftd%3E%3C%2Ftr%3E%3Ctr%3E%3Ctd%3E3%3C%2Ftd%3E%3Ctd%20id%3D'cell'%3Elast%20table%20cell%3C%2Ftd%3E%3C%2Ftr%3E%3C%2Ftable%3E%3Cb%20id%3D'inline'%3Einline%20after%20table%3C%2Fb%3E%3C%2Fdiv%3E&ohh=1&ohj=0&jt=edit.focus()%3B%0Avar%20sel%20%3D%20window.getSelection()%3B%0Avar%20rng%20%3D%20sel.getRangeAt(0)%3B%0A%2F%2F%20Select%20starting%20inside%20the%20last%20table%20cell%0Arng.setStart(cell.firstChild%2C%203)%3B%0A%2F%2F%20End%20selection%20inside%20inline%20after%20table%20cell%0Arng.setEnd(inline.firstChild%2C%203)%3B%0Asel.removeAllRanges()%3B%0Asel.addRange(rng)%3B%0A%0A%2F%2F%20Delete%20the%20selected%20contents%0Adocument.execCommand('Delete')&ojh=0&ojj=0&ms=100&oth=0&otj=0&cex=1
Comment 1 Javier Fernandez 2017-06-09 02:45:23 PDT
This bug is still reproducible in latest trunk. 
I filed a new spec issue to try to gather some feedback about the expected behavior. 

https://github.com/w3c/editing/issues/164
Comment 2 Javier Fernandez 2018-03-07 04:48:44 PST
It seems we have a regression test precisely to ensure we keep the behavior this bug suggests to change:

* editing/deleting/5032066.html

"This tests deleting when the caret is at the start of a paragraph just after a table.  The content in that paragraph should be moved into the last table cell 
unless that content is another table.

So, I'm not sure whether this is a bug or not. There is no spec about this behavior, to my knowledge, so we should fist agree on the expected behavior.
Comment 3 Javier Fernandez 2018-03-07 04:52:11 PST
Created attachment 335185 [details]
Test case to reproduce the bug
Comment 4 Javier Fernandez 2018-03-07 04:52:35 PST
Attached a new test case for the bug.

When trying different browsers, I've got the following results:

When I tried on Chrome,
- First backspace: removed "T" then move caret before "e"
- Second backspace: Move "esting" after "2"

When I tried on Edge,
- First backspace: removed "T" then move caret after "2"
- Second backspace: remove "2"

When I tried on Firefox:
- First backspace: removed "T" then move caret before "e"
- Second backspace: Does nothing