Skip to content

Block recovery when different language editors edit posts, with RTC implications #76610

@Clorith

Description

@Clorith

Description

Currently, if your block uses the translation function __() or equivalent from the i18n package as part of its saved output, if an editor goes to modify the post with another language chosen for the back-end that the block is translated to, they are presented with a block recovery context.

This is a known issue and has existed since the creation of the editor, as the language makes the block markup not match what is expected by the editor, and the recovery procedure is initiated.

With the introduction of the Real Time Collaboration (RTC), we're experiencing an interesting new phenomenon.

Although editors will get the block in their preferred language when using the editor, and this works fine in the editor, whichever editor stored the post last is the language that will be presented on the front-end, I would argue this is also expected behavior.

What is unexpected is that now, if the editors leave the post editor, and either of them return (either singularly, or together), both languages are now presented with the block recovery as if multiple iterations of the block exist simultaneously, and neither are correct.

Step-by-step reproduction instructions

I've included reproductions for the existing known issue, and the new one for the sake of compelteness.

Existing single editor scenario

  • Activate a plugin that uses a translation function (I've attached a simple one from Claude that I threw together that has English and Norwegian Bokmål)
  • Go into a post and add the "Hello World" block.
  • Leave the editor
  • Change your profile language from English to Norwegian
  • Go back into the editor
  • You are now presented with the block recovery options

RTC scenario

  • Activate a plugin that uses a translation function
  • Ensure user-1 uses English, and user-2 uses Norwegian Bokmål as a language.
  • Go into a post with user-1
  • Go into the same post with user-2
  • Have either user add the "Hello World" block
  • Observe that each user is presented with the block in their preferred language.
  • Have user-1 save the post
  • Have both users leave the editor
  • Have user-2 re-visit the post editor
  • Observe the block recovery
  • Have user-1 (who saved the post) re-visit the editor
  • Observe they are also presented with the block recovery option now

Screenshots, screen recording, code snippet

The quick and dirty test plugin I used for the translated block.
experiment-translated-plugin.zip

Video

Video indicating the issue (worth noting in the end, I did not do block recovery on the right side browser window, only the left).
https://github.com/user-attachments/assets/c6c7185d-7832-4b5f-b8bf-580440e89acc

Environment info

WordPress: 7.0-beta5

Also tested on 7.0-beta5 with Gutenberg 22.7.0 installed

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

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Block APIAPI that allows to express the block paradigm.[Feature] Real-time CollaborationPhase 3 of the Gutenberg roadmap around real-time collaboration[Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions