Skip to content

Suggest mode 7/7: inline live wiring, docs, and end-to-end tests#80433

Draft
adamsilverstein wants to merge 2 commits into
suggest/review-uifrom
suggest/inline-wiring
Draft

Suggest mode 7/7: inline live wiring, docs, and end-to-end tests#80433
adamsilverstein wants to merge 2 commits into
suggest/review-uifrom
suggest/inline-wiring

Conversation

@adamsilverstein

@adamsilverstein adamsilverstein commented Jul 17, 2026

Copy link
Copy Markdown
Member

What's in this PR

Wires the inline suggestion engine into the live editor: the addition,
deletion, and format keyboards capture typing / delete / cut / paste /
format toggles on beforeinput and turn them into inline markers; the
content reconciler covers the onChange seams (IME, autocorrect, drag,
multi-line paste); the overlay HOC hands format and content edits off to
those paths before the overlay runs; author colors tint markers per
suggester; annotations decorate them on the canvas; and the note garbage
collector prunes orphaned suggestion notes. Restores the inline apply/reject
branches in the provider, mounts the singletons in the editor provider, adds
the server-side inline marker strip, the architecture doc, and the full e2e
suites (golden path, persistence, review, undo, overlay invariants).


Suggest mode stack

This rebuilds the manually-stacked Suggest mode work (#73411) as a GitHub Stack of 7 small, independently reviewable PRs. Each is CI-green on its own and builds on the one below it:

  1. #80427 - editor intent (edit/suggest/view) + 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, docs, e2e

The whole feature can be exercised end-to-end via the combined testing branch #78994 (Playground). Behind the "Suggestion Mode" experiment (Gutenberg > Experiments).

Wires the inline suggestion engine into the live editor: the addition,
deletion, and format keyboards capture typing / delete / cut / paste /
format toggles on beforeinput and turn them into inline markers; the
content reconciler covers the onChange seams (IME, autocorrect, drag,
multi-line paste); the overlay HOC hands format and content edits off to
those paths before the overlay runs; author colors tint markers per
suggester; annotations decorate them on the canvas; and the note garbage
collector prunes orphaned suggestion notes. Restores the inline apply/reject
branches in the provider, mounts the singletons in the editor provider, adds
the server-side inline marker strip, the architecture doc, and the full e2e
suites (golden path, persistence, review, undo, overlay invariants).
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

Size Change: +8.19 kB (+0.11%)

Total Size: 7.75 MB

📦 View Changed
Filename Size Change
build/scripts/editor/index.min.js 520 kB +8.19 kB (+1.6%)
build/styles/theme/design-tokens-rtl.css 3.06 kB -1 B (-0.03%)
build/styles/theme/design-tokens.css 3.06 kB -1 B (-0.03%)

compressed-size-action

@adamsilverstein adamsilverstein added No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core [Type] Feature New feature to highlight in changelogs. labels Jul 17, 2026
Input events target the editing host. With the editableRoot block support
(native cross-block selection, #79105) that host is the writing-flow wrapper
whenever the selected block has editable siblings, so event.target no longer
identifies the block's rich text. The suggest-mode keyboard interceptors then
never engaged and typing fell through to the per-keystroke reconciler path,
which drops every keystroke after the first (each plan re-validates against a
content snapshot the previous write already moved) - a typed addition in any
multi-paragraph document lost all but its first character.

Resolve the affected element from the event's target range (or the live
selection for clipboard events, which expose no target ranges) instead of
event.target, in both isEventTargetSelectedRichText and readEventRange.

Also harden the tinting e2e: assert the typed run lands inside the marker
(an attribute-only assertion missed the text loss) and assert each marker
resolves its author's exact palette color rather than merely differing, so
a user-id collision on the 7-color palette cannot fail the test.
@adamsilverstein

Copy link
Copy Markdown
Member Author

The markers are tinted per author e2e failure was not a flake - it exposed a real interaction with trunk's #79105 (editableRoot block support, landed after this stack's reference was last e2e-green). Input events target the editing host, and in a multi-paragraph document that host is now the writing-flow wrapper - so the suggest-mode keyboard interceptors, which identified the affected block from event.target, never engaged. Typing then fell through to the content-reconciler path, which drops every keystroke after the first: a typed addition in any multi-paragraph document lost all but its first character.

Fixed in 1b71c34 by resolving the affected element from the event's target range (or the live selection for clipboard events) instead of event.target, in isEventTargetSelectedRichText and readEventRange - this covers the addition, deletion, and paste interceptors. Also hardened the e2e: it now asserts the typed run lands inside the marker (the attribute-only assertion missed the text loss) and that each marker resolves its author's exact palette color, so a user-id collision on the 7-color palette can't produce a false failure.

All 64 suggestion-mode e2e tests pass locally. Cherry-picked to the combined testing branch (#78994) to keep it byte-equal with the stack tip.

@github-actions

Copy link
Copy Markdown

Flaky tests detected in 1b71c34.
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.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/29610435654
📝 Reported issues:

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] Editor /packages/editor [Type] Feature New feature to highlight in changelogs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant