Repository navigation
Suggest mode: explain why formatting is refused across a multi-block selection - #81691
Merged
adamsilverstein merged 1 commit intoAug 23, 2026
Conversation
In Suggest mode a format shortcut pressed across two blocks is refused correctly - the writing-flow wrapper is the editing host for a multi-block selection and cancels its beforeinput, so nothing commits - but the refusal is completely silent. No note, no marker, no snackbar, and no control to point at, because the format toolbar does not render for a multi-block selection at all. Pressing bold and getting nothing reads as a broken editor. Answer the inline-format shortcuts with a snackbar naming the constraint while a cross-block selection is live. Feedback only: the keystroke is left alone, so the refusal itself is unchanged.
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
adamsilverstein
added a commit
to adamsilverstein/gutenberg
that referenced
this pull request
Aug 15, 2026
adamsilverstein
merged commit Aug 23, 2026
b175944
into
WordPress:suggest/inline-wiring
46 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes finding F-30 from the Suggest mode guided testing pass: https://github.com/adamsilverstein/gutenberg/blob/docs/suggest-mode-testing-2026-08-14/suggest-mode-testing/README.md
Part of the Suggest mode work tracked in #73411. Stacked on
suggest/inline-wiring(#80433), same as the rest of this round.The problem
Flow FS-07 asks for "per-block format suggestions or a clean refusal, never a direct commit" when a selection spans a block boundary. The refusal is clean. With a real two-block keyboard selection in Suggesting mode, Cmd+B leaves both blocks byte-identical - no note, no marker, nothing written.
The trouble is that it is also completely silent. Nothing tells the user a decision was taken. Press bold, get nothing, and the editor reads as broken.
Two corrections to the write-up in the doc, both from measuring rather than assuming:
The refusal is not Suggest mode's doing. With a multi-block selection the writing-flow wrapper becomes the editing host, and
useInputcallspreventDefault()on itsbeforeinput- so the browser's nativeformatBoldnever reaches the blocks. That guard is core block-editor behavior and it holds in Editing mode too.And the doc's first proposed remedy, disabling the formatting controls, has nothing to disable.
RichTextShortcutandRichTextToolbarButtonare both registered from inside a rich text's own format edits, which only render while a single block is selected. With a multi-block selection there is no bold button in the toolbar at all - visible in the before screenshot below, where the toolbar shows only block-level tools. So the remaining option is the doc's second one: say why.The fix
A small
SuggestionMultiBlockFormatNoticecomponent that listens for the inline-format shortcuts while a cross-block selection is live in Suggesting mode, and answers with a snackbar: "Formatting suggestions apply to a selection within a single block."Details worth calling out:
@wordpress/format-libraryregisters - bold, italic, underline, link, unlink, strikethrough and code - not just Cmd+B, since all of them go equally quiet.hasMultiSelection()is true in Suggest mode, so there is no keydown handler on the canvas the rest of the time.[data-has-multi-selection="true"], stamped byuseWritingFlow). Block selection survives focus moving to the notes sidebar, sohasMultiSelectionalone would have fired this notice for a Cmd+B typed into a note reply.On the hot files: this touches
packages/editor/src/components/provider/index.jsandsuggestion-mode/index.js, which #81670 and #81674 also edit. The hunks here are two one-line additions in each, in the same import/mount lists, so they should merge cleanly with both.Remaining gap: this is the "clean refusal" half of FS-07. The other half the flow allows, actually capturing per-block format suggestions across a multi-block selection, is a feature rather than a fix and is not attempted here.
Screenshots
Two paragraphs selected across the block boundary in Suggesting mode, immediately after pressing Cmd+B. Before, only the mode-change snackbar from earlier is on screen and the keystroke leaves no trace at all:
After, the same keystroke explains itself, and still writes nothing:
Testing instructions
wp-suggestionmark and no<strong>.Automated coverage
E2E, new file
test/e2e/specs/editor/various/suggestion-mode-multi-block-format.spec.js:Suggestion mode: formatting across blocks › explains why bold does nothing across a multi-block selection- verified red on the unmodified base branch (element(s) not foundwaiting for the snackbar), green with the fix. It also asserts the refusal still holds: nomark.wp-suggestionin the canvas, and nowp-suggestionor<strong>in the serialized post.Suggestion mode: formatting across blocks › stays silent when the same shortcut lands inside one block- the control. Passes on the base branch and with the fix, so the notice is proven not to fire on the ordinary single-block path. It anchors on the format marker actually being written before asserting the snackbar's absence, so the absence is measured after the flow has had its turn.Both were run with
--repeat-each=5, 10/10 passing.Unit, new file
packages/editor/src/components/suggestion-mode/test/multi-block-format-notice.js- six cases covering the notice firing, repeats replacing rather than stacking, and the four ways it must stay quiet (single-block selection, Editing mode, an event outside the multi-selection host, and a non-format shortcut).Neighbouring suites:
suggestion-mode.spec.jsruns 21 passed / 1 failed, the single failure being the known pre-existing "a closed sidebar stays closed when a suggestion is created" (F-17, fixed in #81671, not on this base). Core'smulti-block-selection.spec.jsruns 123/124 across all three browsers, with one webkit case that passes on re-run.AI Use
Code and description both written with 🤖 Claude Code. I will review and test.