Scenario

Pressing Enter inserts two line breaks in contenteditable

In a plain `contenteditable` element, pressing Enter inserts two visible line breaks instead of one.

other
Scenario ID
scenario-double-line-break

Details

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.

This scenario has been observed in multiple environments with similar behavior.

References

Scenario flow

Visual view of how this scenario connects to its concrete cases and environments. Nodes can be dragged and clicked.

React Flow mini map

Variants

Each row is a concrete case for this scenario, with a dedicated document and playground.

Case OS Device Browser Keyboard Status
ce-0003-double-line-break macOS 14.0 Laptop MacBook Pro Safari 17.0 US draft
ce-0023-double-line-break-chrome macOSLinuxWindows Any Desktop Any ChromeEdgeOpera Latest US confirmed

Browser compatibility

This matrix shows which browser and OS combinations have documented cases for this scenario. Click on a cell to view the specific case.

Browser macOS macOSLinuxWindows
ChromeEdgeOpera
Safari
Confirmed
Draft
No case documented

Cases

Open a case to see the detailed description and its dedicated playground.

Related Scenarios

Other scenarios that share similar tags or category.

Tags: enter, newline

Enter vs Shift+Enter behavior differs across browsers

The behavior of Enter and Shift+Enter keys in contenteditable elements varies across browsers. Enter may create a new paragraph, line break, or div, while Shift+Enter may create a line break or behave differently. The resulting DOM structure also varies.

1 case
Tags: enter

Nested list editing behavior is inconsistent

When editing nested lists (lists within list items), the behavior of Enter, Backspace, Delete, and Tab keys varies significantly across browsers. Creating, editing, and deleting nested list items can result in unexpected DOM structures or lost formatting.

3 cases

Comments & Discussion

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