Skip to content

Classic Block: Remove conversion from BlockInvalidWarning#79500

Merged
tyxla merged 1 commit into
trunkfrom
remove/classic-block-invalid-warning
Jun 25, 2026
Merged

Classic Block: Remove conversion from BlockInvalidWarning#79500
tyxla merged 1 commit into
trunkfrom
remove/classic-block-invalid-warning

Conversation

@tyxla

@tyxla tyxla commented Jun 24, 2026

Copy link
Copy Markdown
Member

What?

Removes the Convert to Classic Block option from the invalid block warning (BlockInvalidWarning).

Why?

The classic (core/freeform) block is being de-emphasized and is hidden from the modern inserter. Offering "Convert to Classic Block" as a resolution for an invalid block steers users toward a legacy block we no longer want to promote. The remaining options — Attempt recovery, Resolve, and Convert to HTML — cover the relevant recovery paths.

Part of #78067.

How?

In packages/block-editor/src/components/block-list/block-invalid-warning.js:

  • Drop the canInsertClassicBlock selector (the canInsertBlockType( 'core/freeform', … ) check).
  • Remove the convert.toClassic() converter that created a core/freeform block.
  • Remove the "Convert to Classic Block" entry from secondaryActions.
  • Update both useSelect and useMemo dependency arrays accordingly.

Testing Instructions

  1. Open the editor for a new post.
  2. Open the Code editor (Options menu → Code editor) and paste a block with tampered/invalid markup, e.g.:
    <!-- wp:paragraph -->
    <p>Hello <strong>world</strong></p>
    <div>unexpected extra markup</div>
    <!-- /wp:paragraph -->
  3. Switch back to the Visual editor. The block shows "Block contains unexpected or invalid content."
  4. Open the warning's secondary actions.
  5. Expected: You see Resolve and Convert to HTML, but no "Convert to Classic Block" option.

Testing Instructions for Keyboard

Same

Screenshots or screencast

Before After
Screenshot 2026-06-24 at 20 08 09 Screenshot 2026-06-24 at 20 04 38

Use of AI Tools

This PR was authored with assistance from Claude Code. All code was reviewed by the author before submission.

Remove the 'Convert to Classic Block' option from the invalid block
warning. This drops the canInsertClassicBlock selector, the toClassic
converter, and the core/freeform secondary action, leaving Resolve and
Convert to HTML.
@github-actions github-actions Bot added the [Package] Block editor /packages/block-editor label Jun 24, 2026
@tyxla tyxla changed the title Remove Classic Block conversion from BlockInvalidWarning Classic Block: Remove conversion from BlockInvalidWarning Jun 24, 2026
@tyxla tyxla self-assigned this Jun 24, 2026
@tyxla tyxla added the [Type] Enhancement A suggestion for improvement. label Jun 24, 2026
@tyxla tyxla added the [Block] Classic Affects the Classic Editor Block label Jun 24, 2026
@tyxla tyxla marked this pull request as ready for review June 24, 2026 17:10
@tyxla tyxla requested a review from ellatrix as a code owner June 24, 2026 17:10
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown

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: tyxla <tyxla@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

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

@tyxla tyxla requested review from Mamaduka, t-hamano and yuliyan June 24, 2026 17:11
@github-actions

Copy link
Copy Markdown

Size Change: -59 B (0%)

Total Size: 7.51 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 382 kB -59 B (-0.02%)

compressed-size-action

@github-actions

Copy link
Copy Markdown

Flaky tests detected in 2c2998a.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/28115870488
📝 Reported issues:

@Mamaduka Mamaduka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Makes sense!

@tyxla tyxla merged commit 3e58de9 into trunk Jun 25, 2026
57 checks passed
@tyxla tyxla deleted the remove/classic-block-invalid-warning branch June 25, 2026 07:22
@github-actions github-actions Bot added this to the Gutenberg 23.6 milestone Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Classic Affects the Classic Editor Block [Package] Block editor /packages/block-editor [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants