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
- Focus a contenteditable element
- Type some text
- 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