Case ce-0150-undo-redo-custom-formatting · Scenario scenario-undo-redo-stack

Custom formatting operations cannot be undone

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

Phenomenon

When using preventDefault() and implementing custom formatting operations (bold, italic, etc.), those operations cannot be undone using Ctrl+Z. The undo stack does not include custom operations.

Reproduction example

  1. Implement custom bold formatting with preventDefault()
  2. Apply bold to selected text
  3. Press Ctrl+Z to undo

Observed behavior

  • Bold formatting is not undone
  • Browser’s undo stack does not include the operation
  • User cannot undo custom formatting
  • Undo/redo functionality is broken for custom features

Expected behavior

  • Custom formatting should be undoable
  • Undo stack should include all operations
  • Ctrl+Z should work for custom formatting
  • Redo should also work

Browser Comparison

  • All browsers: Custom operations not in undo stack
  • This is expected when using preventDefault()
  • Custom undo/redo implementation needed

Notes and possible direction for workarounds

  • Implement custom undo/redo stack
  • Save state before each formatting operation
  • Restore state on undo
  • Handle Ctrl+Z and Ctrl+Y manually
Before
Hello World
Basic text
After Custom Bold
Hello World
Custom bold applied via preventDefault()
vs
✅ Expected
Hello World
Expected: Custom formatting 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.