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

Block invalidation error for pullquote block resulting in missing paragraph/text content #45562

Open
griffbrad opened this issue Nov 4, 2022 · 11 comments
Labels
[Block] Pullquote Affects the Pullquote Block [Type] Bug An existing feature does not function as intended

Comments

@griffbrad
Copy link

Description

On a site with a lot of pullquotes on existing pages, loading posts with that content in the editor results in a block invalidation error and the paragraphs embedded in the saved content being stripped with the error "Block validation: Expected tag name 'cite', instead saw 'p'." rendered in the console.

Step-by-step reproduction instructions

  1. Save some content to the DB for a pullquote block with the structure figure > blockquote > p, cite.
  2. You'll receive the above block invalidation error when loading the post in the editor.

Screenshots, screen recording, code snippet

redacted-block-validation-error

Environment info

Gutenberg version: 14.4
WP version: 6.1

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@smerriman
Copy link

Same issue here. Seems a pretty major bug for a core block to be unusable with Wordpress 6.1. Is the only option to downgrade WordPress for the time being?

@griffbrad
Copy link
Author

@ellatrix This could be related to the changes in #43210. Would you be willing to take a look to see if a new deprecation is needed for pullquote?

@smerriman
Copy link

smerriman commented Nov 8, 2022

Ah, yes, that definitely looks like the problem. Just to expand, my client's case is slightly different from the example described above - no cite, but simply two or more paragraphs in the pullquote. The invalidation is due to the save function deleting all but the first paragraph.

It sounds like this was intentionally changed so that pullquotes can no longer have multiple paragraphs, but given this was possible in the past, having them all break probably isn't the best way forward.

(Changing all paragraph breaks to a single line break, which appears to be what the deprecation was trying to do albeit unsuccessfully, would result in quite a visual change too..)

@glendaviesnz
Copy link
Contributor

@griffbrad are you able to provide some block markup that fails for you? I tried with:

<!-- wp:pullquote -->
<figure class="wp-block-pullquote"><blockquote><p>Para 1</p><p>Para 2</p><p>Para 3</p><cite>Test citation</cite></blockquote></figure>
<!-- /wp:pullquote -->

and:

<!-- wp:pullquote -->
<figure class="wp-block-pullquote"><blockquote><p>Para 1</p><p>Para 2</p></blockquote></figure>
<!-- /wp:pullquote -->

and the block was migrated ok when opened in 6.1

@griffbrad
Copy link
Author

griffbrad commented Nov 9, 2022

Looking more closely at the original report, it looks like the user actually had an image within their citation:

<figure>
    <blockquote>
        <p><strong>Paragraph</strong></p>
        <cite><img /></cite>
    </blockquote>
</figure>

@smerriman
Copy link

My example may have some connection with text color / a block ID being in the editor (not sure how the block ID got there, but it's in almost all of them).

<!-- wp:pullquote {"textColor":"black"} -->
<figure class="wp-block-pullquote has-black-color has-text-color" id="block-0d194084-49a9-448a-92a6-1c523ca88626"><blockquote><p>Test</p><p>Test</p></blockquote></figure>
<!-- /wp:pullquote -->

@glendaviesnz
Copy link
Contributor

Thanks for the extra detail @smerriman & @griffbrad, will take another look at it this afternoon

@glendaviesnz
Copy link
Contributor

glendaviesnz commented Nov 9, 2022

I can confirm that in 6.0.3 without GB plugin the following block code is valid:

<!-- wp:pullquote {"textColor":"black"} -->
<figure class="wp-block-pullquote has-black-color has-text-color" id="block-0d194084-49a9-448a-92a6-1c523ca88626"><blockquote><p>Test</p><p>Test</p></blockquote></figure>
<!-- /wp:pullquote -->

with the latest trunk GB installed it invalidates unless the id attribute is removed.

@smerriman
Copy link

And just to iterate, with the block id removed, it validates, but all of the text is squished together and looks considerably different (and quite bad) from a design perspective.

@glendaviesnz
Copy link
Contributor

glendaviesnz commented Nov 9, 2022

prior to #43210 the block markup with the id attribute set validates with the default save method. After #43210 this markup invalidates with the v5 deprecation save method, which is the same as the previous default save method (deprecation attributes are also identical) 🤔 Can't see an obvious reason why - do you have any thoughts @ellatrix ?

@jordesign jordesign added the [Type] Bug An existing feature does not function as intended label Aug 1, 2023
@jordesign
Copy link
Contributor

It looks like this may have stalled for a little while - @glendaviesnz @ellatrix is there anything to move this along?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Pullquote Affects the Pullquote Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

5 participants