Make WordPress Core

Opened 2 years ago

Last modified 7 months ago

#55332 new defect (bug)

problem with quick comment discarded changes

Reported by: linuxarchitect's profile LinuxArchitect Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 5.9.1
Component: Posts, Post Types Keywords:
Focuses: javascript Cc:

Description

The function discardCommentChanges in js/edit-comments.js does not seem to be working as intended. When using the quick comment editor, the function is called when an edit is started, and it does nothing at that point as expected. But if you click away from the form, nothing stops you and you lose your comment changes.

On the other hand, if a plugin enqueues edit-comment.js, buddyboss-platform does (I don't know how/why), and you are editing a post (my attached example is an event venue), the function is triggered on update. With no comments involved, the original content is an empty string and the editied comment is undefined and that triggers the popup warning that changes might be lost.

Attachments (2)

quick comment error.png (104.5 KB) - added by LinuxArchitect 2 years ago.
screenshot of popup warning while editing a post type unrelated to comments
edit-comments.js.patch (581 bytes) - added by LinuxArchitect 2 years ago.
a quick hack patch that prevents the popup when not editing comments

Download all attachments as: .zip

Change History (3)

@LinuxArchitect
2 years ago

screenshot of popup warning while editing a post type unrelated to comments

@LinuxArchitect
2 years ago

a quick hack patch that prevents the popup when not editing comments

#1 @fibrojedi
7 months ago

17 months later and this is still an issue in WP 6.3

This was linked in the classic-editor github - https://github.com/WordPress/classic-editor/issues/147

So, it seems it only affects those using Classic Editor. Which I do and always will. Thankfully, the patch above still works, but the line number it goes into is now 1227 or 1228.

Note: See TracTickets for help on using tickets.