案例 ce-0013 · 场景 scenario-drag-drop-behavior

Drag and drop of text within contenteditable does not work as expected

操作系统: macOS Ubuntu 22.04 设备: Desktop or Laptop Any 浏览器: Chrome 120.0 键盘: US 草稿
drag-dropselectionchrome

此页面尚未翻译

目前显示的是英文原文。欢迎您参与翻译工作。

Phenomenon

Dragging selected text within a contenteditable region to move it to a different position does not work consistently. Sometimes the text is copied instead of moved, or the drop target is not where the mouse pointer indicates.

Reproduction example

  1. Create a contenteditable div with multiple paragraphs.
  2. Select a paragraph of text.
  3. Drag it to a different position within the same contenteditable region.
  4. Observe the result.

Observed behavior

  • In Chrome on macOS, dragging text sometimes results in copying instead of moving.
  • The drop position may not match the visual indicator.
  • The original selection may remain visible after the drop.

Expected behavior

  • Dragging selected text should move it to the drop position.
  • The original text should be removed from its source location.
  • The caret should be positioned at the drop location.

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: macOS Ubuntu 22.04
Device: Desktop or Laptop Any
Browser: Chrome 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.