Case ce-0125-image-deletion-cursor-position · Scenario scenario-image-deletion

Cursor position is incorrect after deleting image in Firefox

OS: Windows 11 Device: Desktop or Laptop Any Browser: Firefox 120.0 Keyboard: US Status: draft
image deletion cursor firefox

Phenomenon

When deleting an image from a contenteditable element in Firefox, the cursor position after deletion is incorrect or unexpected. The cursor may end up in the wrong location or become invalid.

Reproduction example

  1. Insert an image into contenteditable
  2. Place cursor after the image
  3. Press Backspace to delete the image

Observed behavior

  • Image is deleted
  • Cursor position is incorrect or lost
  • Cursor may end up before the image position
  • Or cursor may become invalid

Expected behavior

  • Cursor should be in correct position after deletion
  • Cursor should be where the image was
  • Cursor should remain valid
  • User should be able to continue typing

Browser Comparison

  • Chrome/Edge: Cursor position generally correct
  • Firefox: Cursor position incorrect (this case)
  • Safari: Cursor position most unpredictable

Notes and possible direction for workarounds

  • Intercept image deletion
  • Manually set cursor position after deletion
  • Use Range API to position cursor correctly
  • Restore selection after DOM manipulation
Before
Hello Image| World
Cursor (|) positioned after image
After Delete (Bug)
Hello | World
After image deletion, cursor position is incorrect (moved before image)
vs
✅ Expected
Hello | World
Expected: Cursor maintained at image position

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: Firefox 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.