Skip to content

Conversation

@ingeniumed
Copy link
Contributor

@ingeniumed ingeniumed commented Jan 13, 2026

What?

Instantiate and pass a Yjs Awareness instance to the connection creator - ProviderCreator.

Why?

An Awareness instance allows for the implementation of awareness / presence indicators in the UI. These indicators can be provided by Gutenberg in future PRs. Plugins can also provide an implementation by accessing the Awareness instance passed to the connection creator function.

How?

  • Instantiate and pass an Awareness instance via the connection creator in manager.ts. This way, every provider gets a ready to use Awareness instance.
  • Strongly type everything to do with Awareness. This is done by using classes for the state, and taking advantage of inheritance. An example of this is post-editor-awareness-state.ts which focuses on awareness for the post editor.
  • Focus awareness instance on just the post editor at the moment. This doesn't mean it can't be opened up to other parts of WordPress, it's just right now we would slowly adding into Gutenberg components for Awareness UI in the editor.
  • Expose 2 methods outside of the sync package in order to take advantage of awareness in the post editor, and be able to set the connection status of a user. The former is useful in building components in the editor, and the latter is useful for setting connected/disconnected status in a provider like websockets.

Testing Instructions

By default, we don't have any providers in trunk as of #74555 so we would be using the VIP RTC plugin as that comes up with a websockets provider. Clone https://github.com/Automattic/vip-real-time-collaboration and get it setup before following these instructions.

  1. Check out this branch.
  2. Check out update/awareness-with-plugin
  3. Open a post for editing in two different browser environments.

The awareness instance is unused at the moment.

Testing Instructions for Keyboard

No UI changes in this PR

Follow Up Plan

This'll lay the foundation for Awareness into Gutenberg. After this is merged in, there are 4 more PRs planned to complete this feature:

  1. Update the base awareness and post editor awareness to add in the user info and selection info. This'll allow for presence information to be stored in the awareness instance for use within UI components. A hook will also be added in here to allow for the post editor awareness state to be used within the UI components.
  2. Add in UI components for showing collaborators and their presence indicators. This is currently housed within the VIP RTC plugin and the idea is to move them into Gutenberg. They won't be used, they'll just be created.
  3. Actually use the UI components within the editor, and add in the necessary toggles to control them.
  4. Add tests for all the Awareness classes that have been added

@ingeniumed ingeniumed self-assigned this Jan 13, 2026
@ingeniumed ingeniumed added [Feature] Real-time Collaboration Phase 3 of the Gutenberg roadmap around real-time collaboration [Type] Experimental Experimental feature or API. labels Jan 13, 2026
@github-actions
Copy link

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ingeniumed <ingeniumed@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@ingeniumed ingeniumed changed the title Real-time Collaboration: Add Awareness Real-time Collaboration: Add Yjs awareness Jan 13, 2026
@ingeniumed
Copy link
Contributor Author

Note: This PR doesn't need the experimental flag as it's scoped to the sync package, under the manager.ts. This means, the existing experimental flag checks would continue to work as expected.

@ingeniumed ingeniumed changed the title Real-time Collaboration: Add Yjs awareness Real-time Collaboration: Add Yjs awareness foundation Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Real-time Collaboration Phase 3 of the Gutenberg roadmap around real-time collaboration [Package] Sync [Type] Experimental Experimental feature or API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants