Skip to content

Undo restores a deleted inline Note's marker markup without restoring the Note #80672

Closed

Description

@mcliwanow

Description

I can reproduce a broken Undo state with the inline Notes work introduced for WordPress 7.1. Deleting a saved inline Note trashes the Note and removes its marker. Pressing the editor's normal Undo restores the block's <mark data-id> but it does not restore the Note. The editor reports Saved, and a reload keeps the dead marker markup with no thread.

Step-by-step reproduction instructions

  1. Go to Posts → Add Post and create a draft with the Paragraph: Prefix inline ghost marker target phrase suffix.
  2. Select inline ghost marker, choose the text toolbar's More → Add note, enter Delete then Undo test, and submit it.
  3. Save and reload once; confirm that the highlighted text opens the thread.
  4. Delete it through All notes → Actions → Delete.
  5. Press the top-toolbar Undo exactly once, then wait for Saved (or click Save draft and wait).
  6. Reload and check the code source. Note marker is in the markup but note is not available

Screenshots, screen recording, code snippet

delete-undo-note.mp4

Environment info

  • WordPress 7.1 Beta 3
  • tested on wordpress-develop repo
  • retested on WP Playground too

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Activity

  1. added
    [Type] BugAn existing feature does not function as intended
    on Jul 24, 2026
  2. added
    [Feature] NotesPhase 3 of the Gutenberg roadmap around block commenting
    on Jul 24, 2026
  3. im3dabasia commented on Jul 24, 2026

    @im3dabasia
    Contributor

    Thanks for the detailed report, I can reproduce this too.

    A few thoughts on how we might approach it:

    1. Clean up the orphaned marker on undo. Whatever we decide about restoring notes, the <mark data-id> shouldn't survive an undo when the note itself no longer exists. Stripping the dangling note IDs when undo reinstates that markup would at least keep dead markers out of the saved source.

    2. Prior art in other editors. I looked at how a few others handle deleted comments/notes:

    • Google Docs: once a comment is deleted it's gone for good; undo does not bring it back.

    • Microsoft Word: deleted comments can be fetched back.

    • Figma: shows a confirmation in the delete modal before a comment/note is removed

      Figma delete confirmation

    In my opinion the Figma comparison isn't quite valid here, since it isn't a text-first editor in the way Docs and Word are. That said, our editor isn't purely text-based either, it works on blocks and is used to build sites, so the analogy is imperfect in both directions.

    My preference would be to treat deletion as non-reversible and communicate that clearly to the user, while still offering a small safety net for accidental deletes: an Undo action in the notification that appears after deletion, giving a few seconds to reverse the decision.

    This approach would keep the mental model simple, once the window passes, the note is gone, while still covering the most common failure case, and it avoids the added complexity of restoring trashed notes and their threads after the fact.

    Screen.Recording.2026-07-24.at.4.20.13.PM.mov
  4. mcliwanow commented on Jul 24, 2026

    @mcliwanow
    ContributorAuthor

    My preference would be to treat deletion as non-reversible and communicate that clearly to the user, while still offering a small safety net for accidental deletes: an Undo action in the notification that appears after deletion, giving a few seconds to reverse the decision.

    I like this approach from user perspective :) It's not very easy to delete a note by accident, so maybe even what Google Docs do would be enough though.

  5. adamsilverstein commented on Jul 24, 2026

    @adamsilverstein
    Member

    Thanks for the bug report and detailed steps to reproduce @mcliwanow. I remember we added some e2e tests around undo, but not the flow you described; I'll take a look a bit further to see the best way to fix this.

    My preference would be to treat deletion as non-reversible and communicate that clearly to the user, while still offering a small safety net for accidental deletes: an Undo action in the notification that appears after deletion, giving a few seconds to reverse the decision.

    Yes I expect at this point the actual database record has been deleted, so enabling undo would involve recreating it.... unless we leverage the comment trash capability to trash deleted notes instead of the current immediate delete. These would then get cleaned up later just like with trashed comments. This would be a larger change so for now, probably just not allowing the action or restoring the mark is probably safest.

  6. adamsilverstein commented on Jul 24, 2026

    @adamsilverstein
    Member

    ps. related: I tried testing deleting the text of an inline selection. I thought maybe the note would become orphaned (what happens when you delete a block a note is on). instead, it migrated from a selection to to a block level note on the same block. hitting undo restored the selected text and the note moved to that selection.

  7. moved this from 📥 Todo to 🏗️ In Progress in WordPress 7.1 Editor Taskson Jul 24, 2026
  8. adamsilverstein commented on Jul 25, 2026

    @adamsilverstein
    Member

    I opened a PR that should resolve this: #80710

  9. adamsilverstein commented on Aug 5, 2026

    @adamsilverstein
    Member

    Follow up to my earlier comment: I gave enabling undo a spin in #81243 which takes the trash approach - deleting now moves the note to the comment trash and the deletion snackbar offers an Undo action that restores the note, its replies and its inline marker. Testing appreciated!

  10. moved this from 🏗️ In Progress to 🦵 Punted to 7.2 in WordPress 7.1 Editor Taskson Aug 10, 2026
  11. adamsilverstein commented on Aug 12, 2026

    @adamsilverstein
    Member

    Moving to 7.2.

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

Metadata

Metadata

Labels

[Feature] NotesPhase 3 of the Gutenberg roadmap around block commenting[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions