Closed Bug 1358228 Opened 8 years ago Closed 8 years ago

execCommand("defaultparagraphseparator", false, "p"); doesn't insert paragraphs when started off in a <div>

Categories

(Core :: DOM: Editor, defect, P3)

defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jorgk-bmo, Unassigned)

Details

+++ This bug was initially created as a clone of Bug #1353695 +++ Use attachment from 8854803 from bug 1353695. Click in front of "On 2/13/15 ...". Hit enter twice. Perhaps I'm expecting too much, but instead of adding <p> tags, this splits the <div> and adds <br>s: <div class="moz-cite-prefix"><br type="_moz"></div> <div class="moz-cite-prefix"><br></div>
Flags: needinfo?(ayg)
The cursor is inside a <div>, so when you hit Enter it splits the <div>. This is the same behavior we always had for <p> AFAIK. In https://hg.mozilla.org/mozilla-central/rev/d4f23591dd74 I changed it to apply to <div> also. I see this behavior in Chrome and WebKit as well. I don't have Edge handy right now to test, but according to my commit message it apparently behaves the same. I don't think this behavior is correct semantically, because a <div> is a generic container and shouldn't be used as a paragraph separator. But other browsers aren't going to change, so I deliberately chose to match them. Does this cause specific problems that you think warrant going against the behavior of all other browsers?
Flags: needinfo?(ayg)
Thanks for the explanation. (In reply to Aryeh Gregor (:ayg) (working March 28-April 26) from comment #1) > Does this cause specific problems that you think warrant going against the > behavior of all other browsers? No, I don't see specific problems, but the behaviour seems odd, as you stated. Particularly in the context of editing an e-mail reply (attachment 8854803 [details] from bug 1353695) where we end up with multiple <div>s where the user wanted to create a "free" space in front of the existing one.
Unfortunately, after bug 1297414, div doesn't work well in the editor as anything but a paragraph separator. I think it's lame, but there you have it.
Priority: P1 → P3
Although I agree in theory our old behavior was better, I think this is WONTFIX unless someone comes up with a reason that's compelling enough to go against all (?) other browsers.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
We can live with WONTFIX here. FYI, we've adopted setting the default paragraph separator in TB composition and we're doing well with this: https://dxr.mozilla.org/comm-central/rev/f593d2d106c15ad9682a35eaa1a8679e7127acd6/mail/components/compose/content/MsgComposeCommands.js#5362 The advantage is that people choosing to write e-mail using paragraphs, no always get paragraphs. It's unfortunate that <div>s don't also produce paragraphs when split, but not tragic.
You need to log in before you can comment on or make changes to this bug.