Skip to content

Suggest mode 6c: Capture and apply block-move suggestions (mechanism)#77978

Open
adamsilverstein wants to merge 1 commit into
suggest-mode-6b-insert-uifrom
suggest-mode-6c-move-mechanism
Open

Suggest mode 6c: Capture and apply block-move suggestions (mechanism)#77978
adamsilverstein wants to merge 1 commit into
suggest-mode-6b-insert-uifrom
suggest-mode-6c-move-mechanism

Conversation

@adamsilverstein

@adamsilverstein adamsilverstein commented May 5, 2026

Copy link
Copy Markdown
Member

What

Adds the data-layer mechanism for block-move suggestions (#77434, task 6c). In Suggest mode a moved block stays at its new position but is tagged with metadata.suggestion = { type: 'pending-move', fromAnchorClientId, fromParentClientId, fromIndex }. Auto-save persists as a block-move op; Apply clears the marker; Reject runs moveBlockToPosition to revert.

Visual treatment lands in the next PR (#77979).

How

Move detection uses two signals:

  1. Cross-parent: any block whose parent changed is a definite move.
  2. Within-parent reorder: blocks not in the LCS of the parent's old vs new sibling order are reordered moves. The LCS step prevents tagging blocks whose index just shifted as a side-effect — moving B from index 1 to 3 in [A,B,C,D] tags only B.

Testing

  • 141 unit tests pass. Lint 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

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.

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

Size Change: +559 B (+0.01%)

Total Size: 8.59 MB

📦 View Changed
Filename Size Change
build/scripts/editor/index.min.js 479 kB +559 B (+0.12%)

compressed-size-action

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

Flaky tests detected in 6f205be.
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/25407196070
📝 Reported issues:

@adamsilverstein adamsilverstein force-pushed the suggest-mode-6b-insert-ui branch from ba2a3b7 to 37984e4 Compare June 17, 2026 21:12
@adamsilverstein adamsilverstein force-pushed the suggest-mode-6c-move-mechanism branch from 75a6a73 to 0828f5c Compare June 17, 2026 21:13
@adamsilverstein adamsilverstein force-pushed the suggest-mode-6b-insert-ui branch from 37984e4 to 96a19c0 Compare June 17, 2026 21:20
@adamsilverstein adamsilverstein force-pushed the suggest-mode-6c-move-mechanism branch from 0828f5c to 9fec5ed Compare June 17, 2026 21:20
Moves in Suggest mode now flow through the apply-and-tag pipeline:
the block stays at its new position, the metadata.suggestion =
pending-move marker carries the from-parent + from-anchor + from-
index, and auto-save persists a block-move operation.

The detection heuristic combines two signals: any block whose parent
changed is a cross-parent move; within the same parent, blocks NOT in
the LCS of old vs new sibling order are reordered moves. The LCS step
prevents tagging blocks whose index just shifted as a side-effect of
another block moving past them — moving B from index 1 to 3 in
[A,B,C,D] tags only B, not the C+D that filled the gap.

Apply clears the marker (the block is already at its proposed
location). Reject clears the marker and dispatches
moveBlockToPosition to revert to the from-parent + from-index. Both
paths run with bypass so the interceptor doesn't fight them.

Refs #77434.
@adamsilverstein adamsilverstein force-pushed the suggest-mode-6b-insert-ui branch from 96a19c0 to 26727b9 Compare June 18, 2026 06:32
@adamsilverstein adamsilverstein force-pushed the suggest-mode-6c-move-mechanism branch from 9fec5ed to b0d4b37 Compare June 18, 2026 06:33
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