Skip to content

Collaborator selection awareness overlay disappears entirely when the first or last block of a multi-block selection is deleted #79867

Open

Description

@giteshsarvaiya

Description

Description:

When a collaborator has an active multi-block selection, deleting the first or last block of that selection (either by the selecting user themselves, or by another collaborator) causes the entire selection-awareness overlay to disappear — not just for the deleted block, but for the whole selection. This affects both the observer's view and, shortly after, the selecting user's own view once the deletion syncs.

Expected behavior:

Deleting one endpoint block of a multi-block selection should update the awareness overlay to reflect the remaining valid selection, similar to how deleting a middle block does not clear the whole overlay.

Actual behavior:

  • On User B's (the deleter's) screen: User A's entire awareness overlay — both the highlight and the avatar — disappears immediately.
  • On User A's screen: their own selection also clears shortly after, once the deletion syncs via Yjs.
  • Deleting a middle block (not an endpoint) does not reproduce this — only first/last block deletion does.

Root cause (two independent, pre-existing layers):

  1. Rendering layer — computeMultiBlockOverlayRects (in packages/editor/src/components/collaborators-overlay/) looks up selection endpoint blocks via [data-block] DOM selector. When an endpoint block is deleted, the lookup fails and the function returns {}, clearing all rects for the entire selection rather than just the affected endpoint. This mirrors an existing defensive early-return already present on trunk for single-block WholeBlock selections.
  2. Yjs layer — Once the deletion syncs to the selecting user, their stored Y.RelativePosition anchor for the deleted endpoint can no longer be resolved. resolveSelection throws; the surrounding try/catch swallows the error silently, clearing awareness on the selecting user's side too.

Additional context:

  • Both root causes pre-date the most recent multi-block awareness overlay work and are not introduced by it, though they were surfaced during testing of that work.
  • A partial fix is possible on the rendering layer alone (fall back to the remaining valid blocks when an endpoint block is deleted, instead of clearing everything), but a full fix also requires addressing Y.RelativePosition resolution on the Yjs layer.
  • Screen recording attached: [attach video here]

Step-by-step reproduction instructions

Steps to reproduce:

  1. Open a post with multiple blocks in two collaborator sessions (User A and User B) with real-time collaboration enabled.
  2. User A selects multiple blocks with Ctrl+A (or a drag selection spanning several blocks).
  3. User B deletes the first or last block within that selection range.
  4. Observe both User B's screen and User A's screen.

Screenshots, screen recording, code snippet

Screen.Recording.2026-07-04.140734.mp4

Environment info

Environment:

  • Gutenberg version: 7.1-alpha-62588
  • Real-time collaboration enabled: Yes

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

Activity

  1. added
    [Type] Bug
    on Jul 5, 2026
  2. added
    [Feature] Real-time Collaboration
    on Jul 6, 2026
  3. dilipom13 commented on Aug 28, 2026

    @dilipom13
    Contributor

    Hello Team
    I want to work on the rendering-layer fix for this issue.

  4. added
    [Status] In Progress
    on Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Feature] Real-time Collaboration[Status] In Progress[Type] Bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions