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

File block with a pdf upload becomes invalid in the editor when changing languages #43013

Closed
talldan opened this issue Aug 5, 2022 · 3 comments
Labels
[Block] File Affects the File Block [Type] Bug An existing feature does not function as intended

Comments

@talldan
Copy link
Contributor

talldan commented Aug 5, 2022

Description

Discovered in #42745 (comment).

The file block uses __ in its save function. It's a static block so the internationalized output causes the block to be non-deterministic, resulting in validation errors.

Typically save output for static blocks can't be internationalized.

This could be a tricky one to solve, as removing the use of __ could cause a lot of blocks added in the non-default language to become invalidated. Maybe a deprecation is possible though.

Step-by-step reproduction instructions

To repro (in the post editor):

  1. Upload a pdf to a file block
  2. Publish the post
  3. Change to a different language
  4. Reload the post in the editor
  5. Observe that the file block now has a validation error

I would recommend reproducing without the Gutenberg plugin active, as a lot of the translations are missing (at least for the dev version).

Screenshots, screen recording, code snippet

Screen Shot 2022-08-05 at 12 33 52 pm

Environment info

No response

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

@talldan talldan added [Type] Bug An existing feature does not function as intended [Block] File Affects the File Block labels Aug 5, 2022
@petitphp
Copy link
Contributor

petitphp commented Aug 5, 2022

I successfully reproduced the issue with a WordPress 6.0.1 install without the Gutenberg plugin.

  • I've inserted a file block in a new article, uploaded a pdf and save it,
  • I went to the user profile and changed the site locale from EN to FR,
  • I've reopened the article and observed that the file block encountered a validation error.

This error displayed in the web console :

Block validation: Block validation failed for `core/file`

Content generated by `save` function:

<div class="wp-block-file"><object [...] aria-label="Contenu embarqué lorem_ipsum."></object>[...]</div>

Content retrieved from post body:

<div class="wp-block-file"><object [...] aria-label="Embed of lorem_ipsum."></object>[...]</div>

The validation error did come from the localized aria-label of the object element changing with the locale.

@github-actions
Copy link

github-actions bot commented Feb 3, 2023

Hi,
This issue has gone 180 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.
Thanks for helping out.

@github-actions github-actions bot added the Needs Testing Needs further testing to be confirmed. label Feb 3, 2023
@talldan talldan removed the Needs Testing Needs further testing to be confirmed. label Feb 3, 2023
@talldan
Copy link
Contributor Author

talldan commented Feb 3, 2023

This one was fixed by #43050

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

No branches or pull requests

2 participants