[whatwg/dom] Make preventDefault reserve undo history saving option (Issue #1501)

NagayamaToshiaki created an issue (whatwg/dom#1501)

### What problem are you trying to solve?

This issue is a rewrite of the issue I made to [ecma262](https://github.com/tc39/ecma262/issues/3965).

While many systems use `contenteditable`, managing browser undo/redo history is painful because:
1. When using `preventDefault()` to input or paste event, the history can't follow those operations.
2. Bypassing all browser undo and managing undo history by hand is tedious.

### What solutions exist today?

_No response_

### How would you solve it?

We wish is we could use undo history easier?
The best thing is changing current `preventDefault()` behavior to save undo history anyway, but this would cause bugs. So instead I'd like to add an option parameter:

```javascript
document.querySelector("#editor").addEventListener("paste", (e) => {
    e.preventDefault(true); // preventDefault does not need args as of now, so adding them is not dangerous.
}
```
or like this:
```javascript
    e.preventDefault({undo: true}); // Purpose has made clearer.
```

### Anything else?

_No response_

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1501
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/1501@github.com>

Received on Tuesday, 1 September 2026 02:19:53 UTC