Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sidebar trash button gets rendered late + does not require confirmation + takes long time to redirect, can lead to accidental deletion of a published (home) page without the user knowing it happened #34436

Closed
1 of 2 tasks
Inwerpsel opened this issue Sep 1, 2021 · 0 comments · Fixed by #50219
Labels
[Feature] History History, undo, redo, revisions, autosave. General Interface Parts of the UI which don't fall neatly under other labels. [Type] Enhancement A suggestion for improvement. [Type] Performance Related to performance efforts

Comments

@Inwerpsel
Copy link

Inwerpsel commented Sep 1, 2021

Description

This is a description of a scenario that happened to me for the home page, luckily on a test environment, while trying to navigate to the revisions to restore an earlier version. I attached a video where I re-enacted this scenario. The first 20 seconds contain the following steps, after that are the steps needed to restore the home page.

  1. I navigated to the home page just to follow the revisions link, so I quickly wanted to click it after page load.
  2. The post trash button has a delay before it appears. It pushes down the revisions link and ends up more or less where that link was. This could be partly due to our particular setup, but at first sight from checking the source of the button it seems like it should be able to occur elsewhere.
  3. I clicked it by accident, but this doesn't result in any immediate notification. The only indication is that the post save button starts displaying "Updating...", but only after some delay.
  4. I hadn't noticed I clicked the trash button, so after that I quickly clicked the revisions link. Because I was quick enough the editor was not yet in an updating state, so I navigated to the revisions page without getting a browser prompt when leaving the page.
  5. I then navigated to the revisions, which I could just browse. I went to the one I wanted to restore, and only after clicking "Restore This Revision" I noticed what had happened, when it gave me an error saying I can't restore the item because it's in trash.

Especially in case of the home page this has a nasty effect. The home page setting gets reverted to the default WP post listing. You need to go to trash, un-trash the home page, edit the home page to re-publish it, and then go to Appearance > Customize > Home Page Settings to re-select it as the home page. Before completing those steps your home page will likely look very broken.

In this case I noticed it had happened because I wanted to restore a revision. But imagine if a user just wanted to check a revision without restoring it, and closed his browser after checking the revision. This user would not know that he just trashed the home page of his live site.

There's a few things going wrong here, the most important one being that the trash button will trash any published post, even if it's the homepage, without confirmation. A destructive action on published content like this should require a confirmation that makes it almost impossible to do by accident.

Other possible improvements:

  • Ensure the button is there from the start so there's no layout jump.
  • There should be no delay between pressing the trash button and the page requiring you a prompt when navigating away.
  • The revisions page could display that it's a trashed post and not show the button, instead of the button resulting in an error.
  • Maybe an extra warning in case of the home page, saying that this will make the site revert to the default WP post listing. Or even better, trashing the home page could be disallowed entirely, requiring you to first set another page as the home page.

Step-by-step reproduction instructions

  1. Load the post editor page.
  2. Wait for the "Move to Trash" button to appear.
  3. Click the trash button, then immediately click the revisions link. (this part would happen by accident because the trash button appears in the place of the revisions link)
  4. You're navigated to the revisions page without having received any confirmation that you deleted a post.

Screen recording

The issue is only the first 20 seconds of the video, afterwards is included to show the effect on the home page and the steps needed to restore it.

accidental-home-page-deletion-reenactment.1.mp4

Environment info

WordPress version: 5.6.4 (but I think it can happen on any recent WP version)
Not using the Gutenberg plugin, so we're using the Gutenberg version shipped with 5.6.4

Pre-checks

  • I have searched the existing issues.
  • I have tested with all plugins deactivated except Gutenberg.
@annezazu annezazu added [Feature] History History, undo, redo, revisions, autosave. [Type] Enhancement A suggestion for improvement. [Type] Performance Related to performance efforts General Interface Parts of the UI which don't fall neatly under other labels. labels Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] History History, undo, redo, revisions, autosave. General Interface Parts of the UI which don't fall neatly under other labels. [Type] Enhancement A suggestion for improvement. [Type] Performance Related to performance efforts
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants