Editing a page that has a Spacer block with an HTML Anchor produces message “This block contains unexpected or invalid content.” #49382
Labels
Backwards Compatibility
Issues or PRs that impact backwards compatability
[Feature] Blocks
Overall functionality of blocks
[Status] Duplicate
Used to indicate that a current issue matches an existing one and can be closed
[Type] Bug
An existing feature does not function as intended
[Type] Regression
Related to a regression in the latest release
Description
Our website has pages that contain Spacer blocks with HTML Anchors defined. The site has been working for months with this design. Last edits were done in October 2022. Now when I try to edit these pages every one of these Spacer blocks shows the error message “This block contains unexpected or invalid content."
If I choose "Attempt Block Recovery" the Spacer block is restored, but without the anchor. I can then manually add the anchor back, save the page, and all is good... until some future date when a subsequent page edit shows this error again. (What I mean by 'future date' is that I encountered this problem in January 2022, rebuilt the Spacer blocks with Anchors, and everything looked good. The next round of edits in October 2022 worked fine. Then in March 2023 the Spacer Blocks with Anchors choke again when I edit these pages.)
There is no apparent difference in the HTML code generated to specify the anchor between January 2022 and now, but the editor chokes on processing the existing code, then allows adding the Anchor to the Spacer and generates the same code. My expectation is that the existing Spacer does not produce any “This block contains unexpected or invalid content" errors.
Step-by-step reproduction instructions
Steps to reproduce:
Screenshots, screen recording, code snippet
Excerpt from console log showing Block validation messages:
![Spacer-Anchor (4)](https://user-images.githubusercontent.com/92945757/228060629-d29669d4-4d3e-428f-a59b-4264e824a4ff.JPG)
Environment info
WordPress Version: 6.1.1
WordPress.com Editing Toolkit 3.60227
Gutenberg 15.4.0
Firefox 111.0
Desktop with Windows 10
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
No
The text was updated successfully, but these errors were encountered: