Pressing Enter inserts two line breaks in contenteditable
OS: macOS 14.0 · Device: Laptop MacBook Pro · Browser: Safari 17.0 · Keyboard: US
Open case →Scenario
In a plain `contenteditable` element, pressing Enter inserts two visible line breaks instead of one.
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.
Visual view of how this scenario connects to its concrete cases and environments. Nodes can be dragged and clicked.
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 |
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 | — |
Open a case to see the detailed description and its dedicated playground.
OS: macOS 14.0 · Device: Laptop MacBook Pro · Browser: Safari 17.0 · Keyboard: US
Open case →OS: macOSLinuxWindows Any · Device: Desktop Any · Browser: ChromeEdgeOpera Latest · Keyboard: US
Open case →Other scenarios that share similar tags or category.
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.
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.
Have questions, suggestions, or want to share your experience? Join the discussion below.