Skip to content

Suggestion mode 8/10: overlapping suggestions - #86206

Closed
adamsilverstein wants to merge 28 commits into
suggest/inline-wiringfrom
suggest/overlap
Closed

adamsilverstein wants to merge 28 commits into
suggest/inline-wiringfrom
suggest/overlap

Conversation

@adamsilverstein

@adamsilverstein adamsilverstein commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Part of #73411

Closed, not dropped. This layer was folded into the rest of the stack on 2026-11-21, and each piece now sits in the layer that owns it: the rules, formatting deltas and shared fixtures in #80431, the editor wiring and the server side in #80433, and the e2e specs in #82048. The description below is kept as it was when this was layer 8 of 10.

Replaces #85794, which GitHub closed as merged into suggest/e2e while the stack was being reordered. This layer now sits right after inline live wiring, so the docs and e2e layers above it describe and test the final behavior. The overlap edits to the architecture docs moved into #82047, and the overlap e2e specs moved into #82048. The code is unchanged: the top of the stack has the same tree as before.

Claude and a small team of agents built this from the overlap plan, summary below:

What's in this PR

Overlapping suggestions now follow the Google Docs model instead of being refused. A character carries a list of suggestion ids per kind, and formatting suggestions carry a per-id delta. One rule decides everything: a character is published when every addition on it is accepted and no deletion on it is accepted; its formatting is the base plus every accepted delta, in id order. Accept and reject in any order end at the same text.

  • Stacked markers. One <mark> per suggestion, nested when they overlap, sorted by kind then id (oldest outermost). Typing inside another author's addition or deletion, deleting over their deletion, and replacing a selection that touches either are allowed now.
  • Formatting deltas. Formatting over someone's formatting change, across the edge of their addition, and over your own addition are allowed. Rejecting a straddling change no longer brings back rejected added text on the front end ("Hello big world." vs "Hello world.").
  • Block level. Removing another author's suggested, removed or moved block nests a removal instead of replacing their suggestion. A second author's attribute change on the same block is its own proposal. Each is accepted or rejected on its own.
  • Real-time collaboration. The marker guard keeps stacks, drops garbled, empty and foreign markers, and elects one peer to write each correction, which fixed duplicated markup when several peers corrected at once.
  • Still refused: Enter inside another author's suggestion, and a second author's move on a block someone already suggested moving.

Formatting delta descriptors are written by the suggestion's author and applied by the reviewer, so event handler attributes, srcdoc and formaction are dropped on the server and in the editor, and style goes through safecss_filter_attr.

Known limitations are in the architecture doc. The main one: core-data's mergeRichTextUpdate diffs HTML per character, so under real-time collaboration two people wrapping overlapping text at the same moment can garble markup. That affects plain formatting too and belongs in a separate core-data change.

Testing

Shared JSON fixtures drive an oracle that derives the expected result of every accept/reject order, and the same fixtures run in Vitest (every order, plus fuzz) and PHPUnit (render and save parity) here, and in Playwright (one test per gesture, plus an order runner) in #82048.

npm run test:unit -- packages/editor/src/components/inline-suggestions packages/editor/src/components/suggestion-mode

Locally: 5350 unit tests pass, PHPUnit --group suggestions passes (330 tests), and 440 of 442 suggestion e2e tests pass. The two failures (suggestion-mode-experiment-off.spec.ts:88 and the post fields "Move to trash is locked" test) fail the same way on suggest/e2e.

To try it by hand: two reviewer accounts take turns on the same post, Reviewer A suggests and saves, Reviewer B suggests on top, then the author resolves them in different orders and confirms the final text matches.


Suggestion mode stack

  1. #80427 - editor intent (edit/suggest) + experiment gate
  2. #80428 - suggestion storage, REST controller, provider
  3. #80429 - block-level capture (attribute + structural)
  4. #80430 - inline marker primitive
  5. #80431 - inline suggestion operations
  6. #80432 - review UI (Apply/Reject sidebar + summary)
  7. #80433 - inline live wiring
  8. this PR - overlapping suggestions
  9. #82047 - architecture documentation
  10. #82048 - end-to-end test suite

Combined testing branch: #78994

AI Use

A group of 🤖 Claude Code agents wrote the code and this description from my overlap plan, and Claude Code also did the restack that moved it here. I will review and test.

🤖 Generated with Claude Code

https://claude.ai/code/session_018vwYjThZWj6b6d3BwR27T2

Characters and blocks can now carry several suggestions at once, in the
Google Docs model, instead of refusing edits that overlap another
author's suggestion. Accept and reject in any order reach the same text.

This moves the overlap work below the docs and e2e layers of the stack,
so those layers describe and test the final behavior. The docs and e2e
edits from the earlier overlap branch move into those layers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vwYjThZWj6b6d3BwR27T2
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

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: adamsilverstein <adamsilverstein@git.wordpress.org>

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

📦 Bundle size

Size Change: +4.2 kB (+0.05%)

Total Size: 8.75 MB

📦 View Changed
Filename Size Change
build/scripts/editor/index.min.js 622 kB +4.17 kB (+0.68%)
build/styles/block-editor/content-rtl.css 6.75 kB +7 B (+0.1%)
build/styles/block-editor/content-rtl.min.css 5.21 kB +6 B (+0.12%)
build/styles/block-editor/content.css 6.76 kB +7 B (+0.1%)
build/styles/block-editor/content.min.css 5.2 kB +9 B (+0.17%)

From 92492d7, not the current head. Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

As a user I want to be able to add multiple close buttons so that users can close the overlay from different positions in /test/e2e/specs/site-editor/navigation-overlay-template-part.spec.js, passed after 1 failed attempt.
Error: expect(locator).toHaveCount(expected) failed

Locator:  getByRole('button', { name: 'Close' })
Expected: 2
Received: 1
Timeout:  5000ms

Call log:
  - Expect "toHaveCount" getByRole('button', { name: 'Close' }) with timeout 5000ms
  - waiting for getByRole('button', { name: 'Close' })
    14 × locator resolved to 1 element
       - unexpected value "1"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-overlay-template-part.spec.js:228:33
does not select blocks in the canvas preview when editing from the sidebar (Site Editor v2) in /test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator: getByRole('combobox', { name: 'Search or type URL' })
Expected: focused
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeFocused" getByRole('combobox', { name: 'Search or type URL' }) with timeout 5000ms
  - waiting for getByRole('combobox', { name: 'Search or type URL' })

    at LinkControl.useLinkControlSearch (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:416:47)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:179:21
should allow user to add and remove multiple local font files in /test/e2e/specs/admin/font-library.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeVisible() failed

Locator: getByLabel('Exo 2 Semi-bold Italic')
Expected: visible
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeVisible" getByLabel('Exo 2 Semi-bold Italic') with timeout 5000ms
  - waiting for getByLabel('Exo 2 Semi-bold Italic')

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/admin/font-library.spec.js:58:6
should select synced pattern in /test/e2e/specs/editor/various/writing-flow.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  locator('[name="editor-canvas"]').contentFrame().locator('[data-type="core/block"]')
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" locator('[name="editor-canvas"]').contentFrame().locator('[data-type="core/block"]') with timeout 5000ms
  - waiting for locator('[name="editor-canvas"]').contentFrame().locator('[data-type="core/block"]')
    14 × locator resolved to <div tabindex="0" role="document" draggable="true" data-title="Pattern" data-type="core/block" data-is-drop-zone="true" aria-label="Block: Pattern" id="block-a839389f-9c2f-42a4-b6a8-87ab56691c4f" data-block="a839389f-9c2f-42a4-b6a8-87ab56691c4f" class="block-editor-block-list__block wp-block is-selected is-reusable block-library-block__reusable-block-container wp-block-block block-editor-block-list__layout">…</div>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/writing-flow.spec.js:1464:5
submenus in a custom overlay set to open on click, do not display until clicked in /test/e2e/specs/editor/blocks/navigation-frontend-interactivity.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for getByRole('button', { name: 'Open menu' })
    - locator resolved to <button aria-haspopup="dialog" aria-label="Open menu" data-wp-on--click="actions.openMenuOnClick" data-wp-on--keydown="actions.handleMenuKeydown" class="wp-block-navigation__responsive-container-open always-shown">…</button>
  - attempting click action
    2 × waiting for element to be visible, enabled and stable
      - element is visible, enabled and stable
      - scrolling into view if needed
      - done scrolling
      - <a class="ab-item" role="menuitem" href="http://localhost:8891/wp-admin/about.php">About WordPress</a> from <div class="nojq" id="wpadminbar">…</div> subtree intercepts pointer events
    - retrying click action
    - waiting 20ms
    2 × waiting for element to be visible, enabled and stable
      - element is visible, enabled and stable
      - scrolling into view if needed
      - done scrolling
      - <a class="ab-item" role="menuitem" href="http://localhost:8891/wp-admin/about.php">About WordPress</a> from <div class="nojq" id="wpadminbar">…</div> subtree intercepts pointer events
    - retrying click action
      - waiting 100ms
    19 × waiting for element to be visible, enabled and stable
       - element is visible, enabled and stable
       - scrolling into view if needed
       - done scrolling
       - <a class="ab-item" role="menuitem" href="http://localhost:8891/wp-admin/about.php">About WordPress</a> from <div class="nojq" id="wpadminbar">…</div> subtree intercepts pointer events
     - retrying click action
       - waiting 500ms

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/navigation-frontend-interactivity.spec.js:292:25

From 92492d7, not the current head. Run

adamsilverstein and others added 3 commits November 2, 2026 10:11
# Conflicts:
#	packages/block-editor/CHANGELOG.md
#86206 replaces #85794 as the overlap layer of the stack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vwYjThZWj6b6d3BwR27T2
PHPCS flagged the misaligned double arrows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vwYjThZWj6b6d3BwR27T2
@adamsilverstein adamsilverstein added the No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core label Nov 2, 2026
@adamsilverstein
adamsilverstein marked this pull request as ready for review November 16, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core [Package] Block editor /packages/block-editor [Package] Editor /packages/editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant