Case ce-0153-nbsp-line-break-prevention · Scenario scenario-content-normalization

Non-breaking spaces prevent line breaks unexpectedly

OS: Windows 11 Device: Desktop or Laptop Any Browser: Chrome 120.0 Keyboard: US Status: draft
whitespace nbsp line-break chrome

Phenomenon

When using non-breaking spaces in contenteditable, they prevent line breaks even when the text would normally wrap. This can cause text to overflow or create unexpected layout issues.

Reproduction example

  1. Insert text with multiple non-breaking spaces: Hello   World
  2. Resize the container to be narrow
  3. Observe text wrapping

Observed behavior

  • Text does not wrap at non-breaking spaces
  • Text may overflow container
  • Line breaks are prevented
  • Layout issues occur

Expected behavior

  • Non-breaking spaces should prevent breaks (by design)
  • Or behavior should be predictable
  • Layout should handle nbsp appropriately
  • Users should understand nbsp behavior

Browser Comparison

  • All browsers: Non-breaking spaces prevent breaks (by design)
  • This is expected HTML behavior
  • May need to use regular spaces or CSS for wrapping

Notes and possible direction for workarounds

  • Use regular spaces if wrapping is needed
  • Use CSS word-break or overflow-wrap for long words
  • Replace nbsp with regular spaces if wrapping is desired
  • Document nbsp behavior for users
Before
Hello   World
Text with non-breaking spaces
After Narrow Container (Bug)
Hello   World
No line break even when container narrows, text overflow
vs
✅ Expected
Hello World
Expected: Line break possible when using regular space (or nbsp behavior clearly documented)

Browser compatibility matrix

This matrix shows which browser and OS combinations have documented cases for this scenario. The current case is highlighted. Click on a cell to view other cases.

Current case
Confirmed
Draft
No case documented

All variants (detailed table)

Complete list of all cases for this scenario with full environment details.

Case OS Device Browser Keyboard Status
ce-0102-consecutive-spaces-collapsed Windows 11 Desktop or Laptop Any Chrome 120.0 US draft
ce-0117-nbsp-converted-to-space Windows 11 Desktop or Laptop Any Chrome 120.0 US draft
ce-0153-nbsp-line-break-prevention Windows 11 Desktop or Laptop Any Chrome 120.0 US draft

Playground for this case

Use the reported environment as a reference and record what happens in your environment while interacting with the editable area.

Reported environment
OS: Windows 11
Device: Desktop or Laptop Any
Browser: Chrome 120.0
Keyboard: US
Your environment
Sample HTML:
Event log
Use this log together with the case description when filing or updating an issue.
0 events
Interact with the editable area to see events here.

Comments & Discussion

Have questions, suggestions, or want to share your experience? Join the discussion below.