Skip to content

Post Content Block: Improve removal confirmation modal#75001

Merged
scruffian merged 4 commits intotrunkfrom
update/post-content-block-removal-modal
Feb 2, 2026
Merged

Post Content Block: Improve removal confirmation modal#75001
scruffian merged 4 commits intotrunkfrom
update/post-content-block-removal-modal

Conversation

@annezazu
Copy link
Copy Markdown
Contributor

@annezazu annezazu commented Jan 28, 2026

What?

Enhances the block removal warning modal specifically for the Post Content block with a clearer, more informative design that requires explicit user confirmation before removal.

Why?

Addresses #58136 - Users frequently accidentally remove the Post Content block from templates, causing their content to not display. The existing warning modal was not effective at preventing this.

How?

BlockRemovalWarningModal (packages/block-editor/src/components/block-removal-warning-modal/index.js):

  • Added support for structured message objects (in addition to simple strings for backward compatibility)
  • Added confirmation checkbox that must be checked before the Remove button is enabled
  • Support for custom title, description, warning text, and button labels

BlockRemovalWarnings (packages/editor/src/components/block-removal-warnings/index.js):

  • Post Content block now returns a structured message object with:
    • Title: "Remove content block?"
    • Clear description of what the block does
    • Bold warning about consequences
    • Subtext about visitor impact
    • Required confirmation checkbox
  • Other template blocks (Query, Post Template) continue using the existing string-based warning

Design

Based on design from @jasmussen in #58136:

Modal design

Testing Instructions

  1. Open Site Editor > Templates > Pages
  2. Select the Post Content block
  3. Delete it (press Delete or use block toolbar)
  4. Verify the new modal appears with:
    • Title: "Remove content block?"
    • Description, bold warning, and subtext
    • Checkbox: "I understand the consequences"
    • "Remove" button disabled until checkbox is checked
  5. Verify Cancel closes modal without removing block
  6. Verify Remove (after checkbox) removes the block
  7. Test backward compatibility: remove a Query block - should show old-style "Be careful!" modal

Video

Here's what the new experience looks like:

post.content.block.modal.mov

🤖 Generated with Claude Code

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

Labels

[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Package] Block editor /packages/block-editor [Package] Editor /packages/editor [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants