Case ce-0118-image-deletion-leaves-empty · Scenario scenario-image-deletion

Deleting image leaves empty wrapper elements

OS: Windows 11 Device: Desktop or Laptop Any Browser: Chrome 120.0 Keyboard: US Status: draft
image deletion empty chrome

Phenomenon

When deleting an image from a contenteditable element, empty wrapper divs or other elements may be left in the DOM. These empty elements cause layout issues and bloat the HTML.

Reproduction example

  1. Insert an image into contenteditable
  2. Select the image
  3. Press Delete or Backspace

Observed behavior

  • Image is deleted
  • Empty wrapper <div> elements may remain
  • Or empty <p> elements may remain
  • DOM structure becomes bloated

Expected behavior

  • Image should be deleted cleanly
  • No empty elements should remain
  • DOM should be clean
  • Cursor position should be correct

Browser Comparison

  • Chrome/Edge: May leave empty elements (this case)
  • Firefox: More likely to leave empty structures
  • Safari: Most likely to leave empty elements

Notes and possible direction for workarounds

  • Intercept image deletion
  • Clean up empty wrapper elements
  • Remove parent elements if empty
  • Set cursor position correctly after deletion
Before
Image
Structure with image
After Delete (Bug)
After image deletion, empty wrapper div remains
vs
✅ Expected
Expected: Empty elements removed, clean DOM

Browser compatibility matrix

This matrix shows which browser and OS combinations have documented cases for this scenario. The current case is highlighted. Click on a cell to view other cases.

Current case
Confirmed
Draft
No case documented

All variants (detailed table)

Complete list of all cases for this scenario with full environment details.

Case OS Device Browser Keyboard Status
ce-0118-image-deletion-leaves-empty Windows 11 Desktop or Laptop Any Chrome 120.0 US draft
ce-0125-image-deletion-cursor-position Windows 11 Desktop or Laptop Any Firefox 120.0 US draft
ce-0165-image-selection-deletion Windows 11 Desktop or Laptop Any Chrome 120.0 US draft

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.