Caso ce-0037 · Escenario scenario-undo-redo-behavior

Undo stack is cleared when programmatically modifying content

SO: macOS Ubuntu 22.04 Dispositivo: Desktop or Laptop Any Navegador: Safari 120.0 Teclado: US Borrador
undoprogrammaticsafari

Esta página aún no ha sido traducida

Actualmente se muestra el contenido original en inglés. Agradecemos su contribución a la traducción.

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.

Variantes de este escenario

Caso SO Navegador Estado
ce-0016 Windows 11 Edge 120.0 Borrador
ce-0037 macOS Ubuntu 22.04 Safari 120.0 Borrador

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.