This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 13011 - [editing] Encourage authors to use "white-space: pre-wrap" for contenteditable="" and .designMode=true
Summary: [editing] Encourage authors to use "white-space: pre-wrap" for contenteditabl...
Status: CLOSED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 HTML5 spec (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-21 17:59 UTC by contributor
Modified: 2011-09-23 18:02 UTC (History)
5 users (show)

See Also:


Attachments

Description contributor 2011-06-21 17:59:52 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html
Multipage: http://www.whatwg.org/C#contenteditable
Complete: http://www.whatwg.org/c#contenteditable

Comment:
Encourage authors to use "white-space: pre-wrap" for
contenteditable/designMode

Posted from: 68.175.61.233
User agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.794.0 Safari/535.1
Comment 1 Aryeh Gregor 2011-06-21 18:09:35 UTC
Reasons discussed here:

http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-June/032187.html

Basically, using "white-space: pre-wrap" on the editable region and on the non-editable resulting content will make spaces behave much more reasonably and intuitively.  If you don't, nbsp has to be used for the sake of being non-collapsing, but also prevents breaking, which causes all sorts of minor issues.  Wording could be something along the lines of

"Authors are encouraged to set white-space: pre-wrap on editable elements, and on markup that was originally created in editable elements.  Default HTML whitespace handling is not well suited to WYSIWYG editing, and line wrapping will not work correctly in some corner cases if white-space is left at its default value."

Example of a potential problem without pre-wrap: if the user types "foo  bar", with two spaces in between, that will become either "foo  bar" or "foo  bar".  In the first case, "foo " might wrap to the next line even though "foo" alone could fit on the current line.  In the second case, if " bar" starts a line, it will be visibly indented.

If white-space is pre-wrap, then all browsers but IE will not insert nbsp's at all, just regular spaces, so everything will behave much more sanely.  (But then you do have to use white-space: pre-wrap when you display the content later, too.)
Comment 2 Michael[tm] Smith 2011-08-04 05:13:33 UTC
mass-move component to LC1
Comment 3 Ian 'Hixie' Hickson 2011-08-13 05:38:53 UTC
Where should such advice go? If it's in one of the sections in your draft, it might be better just to put it there so it can be merged in later.
Comment 4 Aryeh Gregor 2011-08-15 17:57:38 UTC
Currently you have the definition and authoring conformance requirements for contenteditable and designMode, and I don't intend to take those over at this point, so I think it makes sense to have this in HTML instead of the editing spec.
Comment 5 Ian 'Hixie' Hickson 2011-08-24 22:13:50 UTC
Roger.
Comment 6 Aryeh Gregor 2011-08-28 15:28:36 UTC
Where did you fix this?  I don't see it.
Comment 7 Ian 'Hixie' Hickson 2011-09-03 19:56:23 UTC
It wasn't fixed. Not sure why I marked it resolved. My apologies. By "Roger" I just meant that I agreed and am intending to do it.
Comment 8 Ian 'Hixie' Hickson 2011-09-23 00:15:26 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with reporter's comments.
Comment 9 contributor 2011-09-23 00:17:17 UTC
Checked in as WHATWG revision r6570.
Check-in comment: Provide advice to authors regarding styling editing regions
http://html5.org/tools/web-apps-tracker?from=6569&to=6570
Comment 10 Aryeh Gregor 2011-09-23 18:02:40 UTC
Perfect, thanks.