Case ce-0003 · Scenario scenario-double-line-break

Pressing Enter inserts two line breaks in contenteditable

OS: macOS 14.0 Device: Laptop MacBook Pro Browser: Safari 17.0 Keyboard: US Status: draft
enter newline

Phenomenon

In a plain contenteditable element, pressing Enter inserts two visible line breaks instead of one. The resulting DOM contains nested <div> or <br> elements that render as an extra blank line.

Reproduction example

  1. Focus the editable area.
  2. Type a short word on the first line.
  3. Press Enter once.
  4. Type another word on what appears to be the second line.

Observed behavior

  • The visual gap between the lines is larger than a single line height.
  • Inspecting the DOM shows two consecutive block-level containers or a sequence of <br> elements that corresponds to two line breaks.

Expected behavior

  • Pressing Enter once inserts a single paragraph break.

Notes and possible direction for workarounds

  • Check whether the browser uses <div>, <p>, or <br> to represent paragraph breaks in this configuration.
  • Adjust CSS line-height and margins to verify whether the effect comes from DOM structure or styling.
  • For products that must normalize the markup, consider translating the native structure into a controlled model (for example, a single <p> per line) before storing or diffing the content.

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.

Browser macOS
Chrome
ce-0023
120.0
Safari
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-0003 macOS 14.0 Laptop MacBook Pro Safari 17.0 US draft
ce-0023 macOS Ubuntu 22.04 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: macOS 14.0
Device: Laptop MacBook Pro
Browser: Safari 17.0
Keyboard: US
Your environment

Use this editable area to reproduce the described case.

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.