ContentEditable div loses <br> tag when you type after selected line of text in Internet Explorer 11

Symptoms

When you type text in a contentEditable div that contains a <br> tag in Internet Explorer 11 or Microsoft Edge, the <br> tag is deleted unexpectedly. This behavior occurs in a contentEditable div that hosts content that's separated by a <br> tag. 

For example, assume that you select Line2 in the following sample HTML and then type asdf:
<div contenteditable="true">
<span>
Line1
<br>
Line2
<br>
Line3
<br>
Line4
</span>
</div>
In this situation, not only is Line2 deleted but also the following <br> tag. Therefore, Line3 joins the text that you typed ("asdf") in Line2, as follows:
<div contenteditable="true">
<span>
Line1
<br>
asdfLine3
<br>
Line4
</span>
</div>
Note This issue occurs if one of the following conditions is true:
  • You press Shift+End to select the line where you'll enter the text.
  • You use the mouse pointer to click just before the <br> tag to select the location for entering the text.

Cause

This issue occurs because the selection tracker service adjusts the selection range during text insertion. The service calls the CSelectTracker::AdjustForCaretRequirements routine, and this moves the end markup pointer so that it includes the trailing line break tag. This, in turn, deletes the line break.

Resolution

To fix this issue, install the most recent cumulative security update for Internet Explorer. To do this, go to Microsoft Update. Additionally, see the technical information about the most recent cumulative security update for Internet Explorer.

Note This update was first included in the MS16-063: Security update for Internet Explorer: June 14, 2016.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

References

Learn about the terminology that Microsoft uses to describe software updates.
Eigenschappen

Artikel-id: 3163201 - Laatst bijgewerkt: 9 feb. 2017 - Revisie: 2

Internet Explorer 11

Feedback