Case ce-0129-undo-redo-stack-cleared · Scenario scenario-undo-redo-stack

Undo stack is cleared unexpectedly on focus changes

OS: Windows 11 Device: Desktop or Laptop Any Browser: Chrome 120.0 Keyboard: US Status: draft
undo redo focus chrome

Phenomenon

When the contenteditable element loses and regains focus, the undo stack may be cleared unexpectedly. Users cannot undo operations that were performed before the focus change.

Reproduction example

  1. Make several edits in contenteditable
  2. Click outside to blur the element
  3. Click back to focus the element
  4. Press Ctrl+Z to undo

Observed behavior

  • Undo stack is cleared
  • Previous operations cannot be undone
  • Undo history is lost
  • User loses ability to undo

Expected behavior

  • Undo stack should be preserved across focus changes
  • Or behavior should be predictable
  • Users should be able to undo previous operations
  • History should be maintained

Browser Comparison

  • Chrome/Edge: Stack may be cleared (this case)
  • Firefox: Similar stack clearing behavior
  • Safari: Stack clearing most unpredictable

Notes and possible direction for workarounds

  • Implement custom undo/redo that persists across focus
  • Save undo stack in memory
  • Restore stack when element regains focus
  • Document undo stack behavior for users
Before Blur
Hello World Test
Multiple editing operations completed
After Blur and Focus
Hello World Test
After focus change, undo stack initialized
vs
✅ Expected
Hello World
Expected: Previous operations can be cancelled with Undo

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-0113-undo-redo-custom-ops Windows 11 Desktop or Laptop Any Chrome 120.0 US draft
ce-0129-undo-redo-stack-cleared Windows 11 Desktop or Laptop Any Chrome 120.0 US draft
ce-0141-undo-redo-multiple-ops Windows 11 Desktop or Laptop Any Chrome 120.0 US draft
ce-0150-undo-redo-custom-formatting Windows 11 Desktop or Laptop Any Chrome 120.0 US draft
ce-0173-undo-redo-custom-text-insert 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: Chrome 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.