contenteditable: chrome inserts divs in p for line breaks
Reported by
robin.fo...@artlogic.net,
Apr 24 2017
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 Steps to reproduce the problem: 1. <p contenteditable="true">hello</p> 2. focus on the ocntenteditable element and hit enter to add line breaks What is the expected behavior? add line breaks but don't add div elements inside a p element What went wrong? chrome inserts div elements inside the p element which is not valid html. the problem isn't immediately apparent but if you were to save the html and re-render it the markup would be altered by the browser Did this work before? Yes not sure Does this work in other browsers? N/A Chrome version: 57.0.2987.133 Channel: stable OS Version: OS X 10.12.2 Flash Version: i think this was working at some point but can't say for sure
,
Apr 25 2017
,
Apr 28 2017
We insert empty DIV for Enter key. We may want to change this behavior.
,
May 9 2017
i would be interested to know why a DIV is used in any case, to me it seems more sensible to use BR as it works in a more consistent way. For example if I wanted to take some text written in a contenteditable block element and put it in an inline element I would have to convert the emptys DIV elements to BR. If the browser just used BR for all cases I wouldn't be faced with this problem.
,
Apr 18 2018
FYI: Firefox inserts <br> when: * there is no block level ancestor https://searchfox.org/mozilla-central/rev/f65d7528e34ef1a7665b4a1a7b7cdb1388fcd3aa/editor/libeditor/HTMLEditRules.cpp#1683,1687,1689 * the block level parent is editing host but it cannot contain the default paragraph separator (<p> or <div>) https://searchfox.org/mozilla-central/rev/f65d7528e34ef1a7665b4a1a7b7cdb1388fcd3aa/editor/libeditor/HTMLEditRules.cpp#1694-1696 * there is no block parent which can contain the default paragraph separator https://searchfox.org/mozilla-central/rev/f65d7528e34ef1a7665b4a1a7b7cdb1388fcd3aa/editor/libeditor/HTMLEditRules.cpp#1701,1706-1707
,
Apr 19 2018
Issue 834217 has been merged into this issue. |
|||
►
Sign in to add a comment |
|||
Comment 1 by erikc...@chromium.org
, Apr 24 2017