Case ce-0012 · Scenario scenario-caret-position-after-paste

Caret position jumps unexpectedly after pasting content

OS: Windows 11 Device: Desktop or Laptop Any Browser: Firefox 120.0 Keyboard: US Status: draft
paste caret position firefox

Phenomenon

After pasting content into a contenteditable region, the caret position does not end up at the expected location, sometimes jumping to the beginning of the pasted content or to an unexpected position.

Reproduction example

  1. Create a contenteditable div with some existing text.
  2. Place the caret in the middle of the text.
  3. Paste content (Ctrl+V or Cmd+V).
  4. Observe the final caret position.

Observed behavior

  • In Firefox on Windows, the caret sometimes ends up at the start of the pasted content instead of after it.
  • The selection range after paste is inconsistent.

Expected behavior

  • The caret should be positioned immediately after the pasted content.

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

Use this editable area to reproduce the described case.

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.