Real-time Collaboration: Add warning for non-syncing meta box fields#75467
Real-time Collaboration: Add warning for non-syncing meta box fields#75467
Conversation
Show a warning banner in meta boxes when real-time collaboration is enabled and the meta box contains form fields that are not registered with the REST API, indicating that changes may not sync with other collaborators.
|
Size Change: +1.32 kB (+0.04%) Total Size: 3.03 MB
ℹ️ View Unchanged
|
| * Known WordPress core form field names that are not post meta keys. | ||
| * These should be excluded when inspecting meta box form fields. | ||
| */ | ||
| const KNOWN_CORE_FIELDS = new Set( [ |
There was a problem hiding this comment.
Can you think of any way to assemble these dynamically, so that new / renamed fields are not flagged?
There was a problem hiding this comment.
Let me look at some options - it wasn't ideal to have these static.
There was a problem hiding this comment.
added both a filter and some expected fields via the REST API lookup. that should hopefully help in the scenarios of checking expected fields and also allow overrides.
Add two applyFilters hooks to allow plugins to customize behavior: - editPost.metaBoxCollaborationWarning.shouldShow: override warning visibility per meta box - editPost.metaBoxCollaborationWarning.ignoredFields: extend the list of excluded field names
Fetch the post entity record's keys dynamically via getEditedEntityRecord to identify REST API properties, replacing most of the hardcoded KNOWN_CORE_FIELDS list. A small FORM_ONLY_FIELDS set remains for form/UI-specific fields with no REST equivalent, and a mapping table covers classic editor field names that differ from REST property names.
|
Flaky tests detected in d2d221d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/21986225947
|
What?
Adds a collaboration warning indicator for meta box fields that may not sync with other collaborators during real-time editing.
Fixes #75308
Why?
When real-time collaboration is enabled, meta box fields that are not registered with the REST API will not sync to other users. Without a visible indicator, users may not realize their changes are invisible to collaborators, leading to confusion and potential data conflicts.
How?
Introduces a
MetaBoxCollaborationWarningcomponent that:postcustom) since it can edit arbitrary metarole="status",aria-live="polite", screen reader text)Testing Instructions
Testing Instructions for Keyboard
role="status"andaria-live="polite"attributes.