Skip to content

Make preventDefault reserve undo history saving option #1501

Open

Description

@NagayamaToshiaki

What problem are you trying to solve?

This issue is a rewrite of the issue I made to ecma262.

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:

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:

    e.preventDefault({undo: true}); // Purpose has made clearer.

Anything else?

No response

Activity

  1. annevk commented on Sep 1, 2026

    @annevk
    Member

    This sounds a lot like https://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html which I don't think was ever finished. @rniwa do you know what the current state of that is?

  2. smaug---- commented on Sep 21, 2026

    @smaug----
    Contributor

    Is this a dup of w3c/editing#509 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interest

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions