Pullquote: Fix deprecated block validation when anchor/id attribute is present#75132
Pullquote: Fix deprecated block validation when anchor/id attribute is present#75132
Conversation
…s present
Add `supports: { anchor: true }` to v5 and v4 deprecated versions so that
blocks with an `id` attribute can be properly migrated.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @smerriman. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +39 B (0%) Total Size: 3 MB
ℹ️ View Unchanged
|
|
Should we also declare other supports based on versions? Or do they not affect parsing? |
The bug only occurs with multi-paragraph content + anchor. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@Mamaduka I restored the support keys exactly as it was at the time |
v5 (August 2022): anchor, align, color, typography, border, style v4 (July 2021): anchor, align, color, border Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
eab5ead to
7be0be9
Compare
Fixes #45562.
What?
Adds
supports: { anchor: true }to the v5 and v4 deprecated versions in the pullquote block'sdeprecated.js.Why?
When a pullquote block has an
idattribute on the figure element (anchor), the deprecated markup upgrade fails and shows an invalid block warning. Without theidattribute, the upgrade succeeds.Failing markup:
Working markup:
Timeline Context
block.jsonuseBlockProps.save()Both v4 and v5 deprecations were created after anchor support was added, so they should have included
supports: { anchor: true }from the start. This PR fixes that oversight.Root Cause
The pullquote block declares
"anchor": truein itssupports(block.json), which:anchorattribute to the blockidattribute into saved HTML via theaddSavePropsfilterThe problem is that v5 and v4 deprecated versions didn't include
supports: { anchor: true }. During deprecation matching:anchorisn't in the deprecated version's supports, theidattribute cannot be extractedidis missingid) doesn't match regenerated HTML (withoutid) → validation failsThis follows the same pattern used by other blocks like
cover/deprecated.jswhich includesanchor: truein its deprecated version supports.How?
supports: { anchor: true }to v5 deprecationsupports: { anchor: true }to v4 deprecationNote: v3, v2, v1, and v0 do not use
useBlockProps.save()and don't output anidattribute, so they don't need this change.Testing Instructions
🤖 Generated with Claude Code