ケース ce-0037 · シナリオ scenario-undo-redo-behavior

Undo stack is cleared when programmatically modifying content

OS: macOS Ubuntu 22.04 デバイス: Desktop or Laptop Any ブラウザ: Safari 120.0 キーボード: US 下書き
undoprogrammaticsafari

このページはまだ翻訳されていません

現在、英語の原文を表示しています。翻訳への貢献をお待ちしております。

Phenomenon

When programmatically modifying the content of a contenteditable region (e.g., using innerHTML or textContent), the undo stack is cleared in Safari. This prevents users from undoing their previous manual edits.

Reproduction example

  1. Create a contenteditable div.
  2. Type some text manually.
  3. Use JavaScript to modify the content: element.innerHTML = 'New content'.
  4. Try to undo (Cmd+Z).
  5. Observe whether the previous manual edits can be undone.

Observed behavior

  • In Safari on macOS, programmatic content changes clear the undo stack.
  • Users cannot undo their previous manual edits after programmatic changes.
  • The undo history is lost unexpectedly.

Expected behavior

  • Programmatic changes should not clear the undo stack for manual edits.
  • Or, there should be a way to preserve undo history across programmatic modifications.
  • The undo stack should be managed more intelligently.

このシナリオの変形

ケース OS ブラウザ ステータス
ce-0016 Windows 11 Edge 120.0 下書き
ce-0037 macOS Ubuntu 22.04 Safari 120.0 下書き

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