Backspace at beginning of list item converts to paragraph in Chrome
OS: Windows 11 · Device: Desktop or Laptop Any · Browser: Chrome 120.0 · Keyboard: US
Open case →Scenario
When pressing Backspace or Delete at the beginning or end of a list item, the behavior varies significantly across browsers. Some browsers delete the list item and merge with adjacent content, while others may delete the entire list or create unexpected DOM structures.
When pressing Backspace or Delete at the beginning or end of a list item (<li>), the behavior varies significantly across browsers. Some browsers delete the list item and merge with adjacent content, while others may delete the entire list or create unexpected DOM structures.
When handling list item deletion, intercept beforeinput events and implement custom deletion logic:
element.addEventListener('beforeinput', (e) => {
if (e.inputType === 'deleteContentBackward' || e.inputType === 'deleteContentForward') {
const selection = window.getSelection();
if (selection.rangeCount === 0) return;
const range = selection.getRangeAt(0);
const listItem = range.startContainer.closest('li');
if (listItem) {
// Check if cursor is at the beginning/end of list item
const isAtStart = range.startOffset === 0 &&
range.startContainer === listItem.firstChild;
const isAtEnd = range.endOffset === (range.endContainer.textContent?.length || 0) &&
range.endContainer === listItem.lastChild;
if (isAtStart || isAtEnd) {
e.preventDefault();
// Implement custom list item deletion logic
handleListItemDeletion(listItem, e.inputType);
}
}
}
});
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-0097-list-item-deletion-chrome | Windows 11 | Desktop or Laptop Any | Chrome 120.0 | US | draft |
| ce-0098-list-item-deletion-firefox | Windows 11 | Desktop or Laptop Any | Firefox 120.0 | US | draft |
| ce-0151-list-item-empty-after-delete | Windows 11 | Desktop or Laptop Any | Safari 17.0 | US | draft |
This matrix shows which browser and OS combinations have documented cases for this scenario. Click on a cell to view the specific case.
| Browser | Windows |
|---|---|
| Chrome | |
| Firefox | |
| Safari |
Open a case to see the detailed description and its dedicated playground.
OS: Windows 11 · Device: Desktop or Laptop Any · Browser: Chrome 120.0 · Keyboard: US
Open case →OS: Windows 11 · Device: Desktop or Laptop Any · Browser: Firefox 120.0 · Keyboard: US
Open case →OS: Windows 11 · Device: Desktop or Laptop Any · Browser: Safari 17.0 · Keyboard: US
Open case →Other scenarios that share similar tags or category.
Deleting images from contenteditable elements behaves differently across browsers. Some browsers delete the image cleanly, while others may leave empty elements, break the DOM structure, or require multiple delete operations.
After deleting an empty or inline element (e.g. span, b) inside contenteditable, typing causes the browser to recreate the deleted element, leading to unpredictable DOM and editor state.
When editing text within list items, formatting such as bold, italic, or links may be lost or behave unexpectedly. The list structure itself may also be lost when certain operations are performed, such as pasting content or applying formatting.
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.
Changing background color (highlighting) in contenteditable elements behaves inconsistently across browsers. Background colors may be applied as inline styles, may not persist when typing, or may interfere with text selection. The behavior differs from text color changes.
Have questions, suggestions, or want to share your experience? Join the discussion below.