Skip to content

Suggest mode 6a: Render block-remove pending state in canvas and sidebar#77970

Open
adamsilverstein wants to merge 2 commits into
suggest-mode-6a-remove-mechanismfrom
suggest-mode-6a-remove-ui
Open

Suggest mode 6a: Render block-remove pending state in canvas and sidebar#77970
adamsilverstein wants to merge 2 commits into
suggest-mode-6a-remove-mechanismfrom
suggest-mode-6a-remove-ui

Conversation

@adamsilverstein

@adamsilverstein adamsilverstein commented May 5, 2026

Copy link
Copy Markdown
Member

What

Adds the visual treatment for block-remove suggestions (#77434, task 6a). Pairs with the mechanism PR (#77968).

  • A block flagged with metadata.suggestion = { type: 'pending-remove' } renders at 50% opacity with a horizontal red rule across its center.
  • The notes sidebar shows a "Remove block: paragraph" summary line and a strikethrough preview of the removed block's text content.

How

  • with-suggestion-overlay.js: BlockListBlock filter reads metadata.suggestion.type and adds is-suggestion-pending-{remove,insert,move} classes alongside the existing attribute-overlay class.
  • style.scss: pending-remove styling (50% opacity + ::after horizontal rule).
  • suggestion-summary.js: handles block-remove ops with a "Remove block: " line.
  • suggestion-diff.js: BlockRemoveDiff renders the captured block snapshot as strikethrough text via a new collectBlockText walker.

Testing

  • 133 unit tests pass. Lint and stylelint clean.
  • For full-stack testing instructions, see the foundations PR (#77967).

Stack

  1. #77967 — Schema v2 bump (foundations)
  2. #77968 — Capture block-remove (mechanism)
  3. #77970 — Render block-remove preview (UI)
  4. #77971 — Capture block-insert-after (mechanism)
  5. #77973 — Render block-insert-after preview (UI)
  6. #77978 — Capture block-move (mechanism)
  7. #77979 — Render block-move preview (UI)

Refs #77434, #73411.

@github-actions github-actions Bot added the [Package] Editor /packages/editor label May 5, 2026
@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

Size Change: +386 B (0%)

Total Size: 8.59 MB

📦 View Changed
Filename Size Change
build/scripts/editor/index.min.js 479 kB +220 B (+0.05%)
build/styles/editor/style-rtl.css 31.1 kB +42 B (+0.14%)
build/styles/editor/style-rtl.min.css 26.5 kB +40 B (+0.15%)
build/styles/editor/style.css 31.1 kB +46 B (+0.15%)
build/styles/editor/style.min.css 26.5 kB +38 B (+0.14%)

compressed-size-action

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

Flaky tests detected in 4a9b565.
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/25406061600
📝 Reported issues:

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

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: 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.

@adamsilverstein adamsilverstein force-pushed the suggest-mode-6a-remove-mechanism branch from 42d77e8 to 83baf50 Compare June 17, 2026 21:12
@adamsilverstein adamsilverstein force-pushed the suggest-mode-6a-remove-ui branch from f859323 to 53bf7fa Compare June 17, 2026 21:12
@adamsilverstein adamsilverstein force-pushed the suggest-mode-6a-remove-mechanism branch from 83baf50 to 6150237 Compare June 17, 2026 21:20
@adamsilverstein adamsilverstein force-pushed the suggest-mode-6a-remove-ui branch from 53bf7fa to f070644 Compare June 17, 2026 21:20
@adamsilverstein adamsilverstein force-pushed the suggest-mode-6a-remove-mechanism branch from 6150237 to 9fb6c86 Compare June 18, 2026 06:28
Brings the visual treatment for block-remove suggestions:

- BlockListBlock filter reads metadata.suggestion.type and adds
  is-suggestion-pending-{remove,insert,move} classes alongside the
  existing is-suggestion-pending overlay class. structuralMarkerClass
  centralizes the marker-to-class lookup so the single rendering layer
  stays a thin shell over the data model. The pre-existing
  attribute-overlay class still applies independently — a block can
  carry both a structural marker and a pending attribute edit.

- style.scss adds the pending-remove treatment: 50% opacity plus a
  centered horizontal red rule via ::after, so selection, focus, and
  the block toolbar keep working while the block reads as proposed
  for deletion. Pending-insert and pending-move styles ship with their
  own follow-up PRs.

- suggestion-summary.js adds a "Remove block: <name>" line via a small
  friendlyBlockName helper that strips the namespace prefix. Falls
  back to "block" when the op carries no name.

- suggestion-diff.js adds BlockRemoveDiff, which renders the captured
  block snapshot (op.block) as strikethrough text. collectBlockText
  walks the snapshot's RichText content and innerBlocks recursively
  with a length cap so a huge subtree doesn't bloat the sidebar.
  Pulled the per-op render decision into a flat DiffForOperation
  component so the JSX stays free of nested ternaries.

Refs #77434.
…intent

The BlockListBlock filter previously bailed out for any client not in
Suggest intent, so a post author reviewing a suggestion in Edit (the
default) saw the canvas in its post-suggestion state with no visual
cue that the change was still pending — a deletion looked already
deleted, an insertion looked like a normal block, etc.

Structural markers live in `metadata.suggestion` on the live block
and travel through the same sync path as block content, so any
intent already has the data needed to render the dimmed/struck
treatment. Drop the suggest-mode gate for the structural-class
branch, and keep it only for the attribute overlay "bracket" — that
one tracks the suggester's local, in-progress edits in the overlay
context, which no other intent has any way to read or act on.

Refs #77434.
@adamsilverstein adamsilverstein force-pushed the suggest-mode-6a-remove-ui branch from f070644 to 4ef0475 Compare June 18, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Notes Phase 3 of the Gutenberg roadmap around block commenting [Package] Editor /packages/editor [Status] In Progress Tracking issues with work in progress [Type] Feature New feature to highlight in changelogs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant