[whatwg] Pressing Enter in contenteditable: <p> or <br> or <div>?
Ryosuke Niwa
rniwa at webkit.org
Fri May 13 10:48:51 PDT 2011
On Fri, May 13, 2011 at 10:26 AM, Aryeh Gregor <Simetrical+w3c at gmail.com>wrote:
>
> I'm not completely decided at this point, but am now leaning toward
> <br>. Currently my spec uses <br> where some type of break is needed
> (e.g., de-indenting an inline node when that would make it the sibling
> of some other inline node), because that's the shortest markup in
> simple cases.
>
Note that br and div affect UBA differently so we must consider what
bidirectional text users want as well.
For example, if we had <div dir="rtl">hello</div>, and inserted br as in
<div dir="rtl">hello<br></div>, then we preserve the RTL directionality. If
we insert div on the other hand, <div dir="rtl">hello</div><div></div>, then
new paragraph will have the containing block's direction.
This will be a tricky issue when people want to mix LTR/RTL paragraphs in
the same editable region.
I guess I'm leaning toward using <br> by default. If any
> implementers feel strongly, now would be a good time to speak up.
I strongly feel that we should default to div for the backward
compatibility. And this is the preferred paragraph separator in many Google
products as far as I know because div allows developers to easy apply style,
add class, etc... to a paragraph. And there seems to be a long history of
browsers inserting inserting p/div on Enter and inserting br on Shift+Enter
(on Windows), and changing that behavior will confuse users who are used to
this behavior.
- Ryosuke
More information about the whatwg
mailing list