Case ce-0105-shift-enter-creates-br · Scenario scenario-enter-vs-shift-enter

Shift+Enter creates br element for line break

OS: Windows 11 Device: Desktop or Laptop Any Browser: Chrome 120.0 Keyboard: US Status: draft
enter line-break br all-browsers

Phenomenon

When pressing Shift+Enter in a contenteditable element, a <br> line break element is created instead of a new paragraph. This behavior is consistent across Chrome, Firefox, and Safari.

Reproduction example

  1. Focus a contenteditable element
  2. Type some text
  3. Press Shift+Enter

Observed behavior

  • A <br> element is inserted
  • Text continues on the next line without creating a new block element
  • This is consistent across all major browsers
  • Useful for line breaks within paragraphs

Expected behavior

  • Shift+Enter should create a line break (current behavior is correct)
  • Enter should create a new paragraph/block
  • Behavior should be consistent (which it is)

Browser Comparison

  • All browsers: Shift+Enter creates <br> consistently
  • This is expected and correct behavior

Notes and possible direction for workarounds

  • This behavior is generally correct and expected
  • May need to handle edge cases where <br> is in unexpected contexts
  • Consider normalizing multiple <br> elements if needed
  • Ensure <br> is properly styled for line breaks
Before
Hello
Basic text
After Shift+Enter
Hello
Shift+Enter creates &lt;br&gt; element (normal behavior)
vs
✅ Expected
Hello
Expected: Shift+Enter creates line break, Enter creates new paragraph (current behavior is correct)

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.