Bug 186377

Summary: A node in contenteditable is removed when all characters in it are removed
Product: WebKit Reporter: Kei Ito <kei.itof>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: rniwa, wenson_hsieh
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: Unspecified   
Attachments:
Description Flags
Steps to Reproduce none

Description Kei Ito 2018-06-06 19:08:55 PDT
Created attachment 342105 [details]
Steps to Reproduce

Summary:
A node in contenteditable is removed when all characters in it are removed by backspace key or delete key etc. if the "position" of the parent node is "relative".

Steps to Reproduce:
# 1. Save the code below as page.html.

<!doctype html>
<meta charset="utf-8">
<style>
.editable {
    margin: 20px;
    padding: 20px;
    background-color: #fcc;
}
.editable div {
    padding: 20px;
    background-color: #ccf;
}
.editable2 div {
    position: relative;
}
</style>
<div contenteditable="true" class="editable editable1">
    <div>ABC</div>
</div>
<div contenteditable="true" class="editable editable2">
    <div>DEF</div>
</div>

# 2. Open Safari
# 3. Drag and drop the page.html onto the address bar
# 4. Click the right of "ABC" and press Backspace 3 times
# 5. Click the right of "DEF" and press Backspace 3 times

You can try it on this page: https://codepen.io/wemotter/pen/jxegxw

Expected Results:
"ABC" and "DEF" are removed and the blue areas remains.

Actual Results:
"ABC" and "DEF" are removed and the first blue area remains but the second is removed.