Fall ce-0003 · Szenario scenario-double-line-break

Pressing Enter inserts two line breaks in contenteditable

OS: macOS 14.0 Gerät: Laptop MacBook Pro Browser: Safari 17.0 Tastatur: US Entwurf
enternewline

Diese Seite wurde noch nicht übersetzt

Derzeit wird der englische Originalinhalt angezeigt. Wir freuen uns über Ihre Hilfe bei der Übersetzung.

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.

Varianten dieses Szenarios

Fall OS Browser Status
ce-0003 macOS 14.0 Safari 17.0 Entwurf
ce-0023 macOS Ubuntu 22.04 Chrome 120.0 Entwurf

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.