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

Add confirm dialog before Permanently delete #67824

Merged

Conversation

karthick-murugan
Copy link
Contributor

What?

Fixes #60383, where the "Permanently Delete" action for trashed posts in the WordPress editor was not functioning as expected. This PR improves the logic and introduces a confirmation modal to ensure users can confirm their actions before permanently deleting posts.

Why?

The current implementation of the "Permanently Delete" action did not provide a clear user experience and lacked safeguards like a confirmation modal. This could lead to unintentional deletions. By addressing this issue, the PR ensures a better and more accessible user experience while reducing the likelihood of errors.

How?

Added a modal confirmation step to confirm the deletion of selected posts.

Testing Instructions

  • Open the WordPress admin dashboard.
  • Navigate to any list of posts.
  • Move one or more posts to the trash.
  • Select the trashed posts and use the "Permanently Delete" option.
  • Confirm the deletion in the modal dialog.
  • Observe the success or error notices for both individual and bulk deletion scenarios.

Screenshots or screencast

REC-20241211165122.mp4

Copy link

github-actions bot commented Dec 11, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: karthick-murugan <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: annezazu <[email protected]>
Co-authored-by: ammar-Mohamed-elz3eeem <[email protected]>
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: afercia <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka
Copy link
Member

@karthick-murugan, entity actions already have built-in support for confirmation modals. See delete-post and trash-post actions for examples.

@Mamaduka Mamaduka requested review from youknowriad and jorgefilipecosta and removed request for youknowriad December 12, 2024 06:48
@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond labels Dec 12, 2024
Copy link
Contributor

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! This looks good code wise. I've left a comment regarding the copy. Also it would be good to rebase.

packages/fields/src/actions/permanently-delete-post.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@ntsekouras ntsekouras changed the title Confirm box before Trash and Permanently delete Add confirm dialog before Permanently delete Dec 20, 2024
@ntsekouras ntsekouras enabled auto-merge (squash) December 20, 2024 09:24
@ntsekouras ntsekouras merged commit 94df941 into WordPress:trunk Dec 20, 2024
60 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.0 milestone Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data Views: Pages: Improve clarity of the Trash and Permanently delete flows
3 participants