You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Undo restores a deleted inline Note's marker markup without restoring the Note #80672
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
Go to Posts → Add Post and create a draft with the Paragraph: Prefix inline ghost marker target phrase suffix.
Select inline ghost marker, choose the text toolbar's More → Add note, enter Delete then Undo test, and submit it.
Save and reload once; confirm that the highlighted text opens the thread.
Delete it through All notes → Actions → Delete.
Press the top-toolbar Undo exactly once, then wait for Saved (or click Save draft and wait).
Reload and check the code source. Note marker is in the markup but note is not available
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
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.
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.
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.
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.
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!
Activity
im3dabasia commentedon Jul 24, 2026
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
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
mcliwanow commentedon Jul 24, 2026
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.
adamsilverstein commentedon Jul 24, 2026
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.
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.
adamsilverstein commentedon Jul 24, 2026
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.
adamsilverstein commentedon Jul 25, 2026
I opened a PR that should resolve this: #80710
adamsilverstein commentedon Aug 5, 2026
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!
adamsilverstein commentedon Aug 12, 2026
Moving to 7.2.