Repository navigation
Suggest mode: register the intent shortcuts only where they can be used - #81695
Merged
adamsilverstein merged 1 commit intoAug 23, 2026
Conversation
The Keyboard Shortcuts help modal lists whatever is registered, so registering the Edit/Suggest/View intent shortcuts behind the experiment flag alone advertised "Switch to Suggest mode." in the Site Editor, where `wp_template` has no `editor.notes` support, no Mode menu renders and the key combination does nothing. Register them on the same runtime predicate the Mode menu and the shortcut handlers already use, and remove them again if it stops passing, so all three gates agree.
|
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
1f317ed
into
WordPress:suggest/inline-wiring
46 checks passed
9 tasks
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-03 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 #73411. Stacked on top of #80433 (
suggest/inline-wiring), which is the base branch here.The problem
The three intent shortcuts (
core/editor/intent-edit,-suggest,-view) were registered whenever the Suggestion Mode experiment flag was on. Registration is what puts a shortcut in the Keyboard Shortcuts help modal, so the Site Editor listed "Switch to Edit mode.", "Switch to Suggest mode." and "Switch to View mode." under Global shortcuts.None of them do anything there.
wp_templatehas noeditor.notessupport, so no Mode menu renders and the handlers inglobal-keyboard-shortcuts/index.jsreturn early. Pressing the combination gives no snackbar and no mode change.The doc's diagnosis held up exactly on measurement: three gates for one feature, and the registration gate was the loose one.
register-shortcuts.jscheckedisSuggestionModeEnabled()(the flag), while the Mode menu (PostTypeSupportCheck supportKeys="editor.notes") and the shortcut handlers (useCanSuggest()) both check the flag AND notes support.The fix
Move the intent registrations into their own effect keyed on
useCanSuggest(), the same runtime predicate the menu and the handlers use.editor.notessupport arrives with the post type record, so the predicate starts false and flips once that resolves - hence a separate effect rather than a condition inside the existing one-shot registration. If it flips back the set is unregistered again, which is the patternBlockEditorKeyboardShortcutsRegisteralready uses for itsblockVisibilityshortcuts.One narrow file,
packages/editor/src/components/global-keyboard-shortcuts/register-shortcuts.js, which no other open PR in this round touches.Visible side effect worth calling out: in the post editor the three entries now sit at the end of the Global shortcuts list rather than in the middle of it, because they register on a later pass. Same shortcuts, same key combinations, same behavior.
Screenshots
Site Editor, Keyboard Shortcuts modal, Global shortcuts section. Before, the three intent shortcuts are advertised on a screen that cannot honor them:
After, they are gone and nothing else moved:
The post editor keeps all three. Before:
After, still listed, now at the end of the section:
Testing instructions
Enable the Suggestion Mode experiment (Gutenberg > Experiments) and use a block theme.
Before (on
suggest/inline-wiring):Shift+Alt+Cmd+H(Mac) orShift+Alt+Hto open Keyboard shortcuts.Shift+Alt+Cmd+X. Nothing happens: no snackbar, no mode change, and there is no Mode section in the Options menu.After (this branch):
Shift+Alt+Cmd+X. The "You're suggesting" snackbar appears and the Options menu shows Suggesting selected.Automated coverage
Unit,
packages/editor/src/components/global-keyboard-shortcuts/test/register-shortcuts.js:Verified red on the unmodified base first: the second and fourth fail there with all three names still registered, while the first and third (the controls) pass on base and after. All four pass with the fix.
E2E,
test/e2e/specs/site-editor/suggestion-mode-intent-shortcuts.spec.js:Same story: on a base build the two post editor controls pass and the Site Editor one fails on "Switch to Suggest mode." still being visible; with the fix all three pass, run with
--repeat-each=5for 15/15. The neighbouring suites were run against the fixed build too -shortcut-help.spec.jsandsuggestion-mode.spec.jsgive 23 passed with the one known pre-existing failure, "a closed sidebar stays closed when a suggestion is created", which is F-03's neighbour F-17 and is fixed separately in #81671.AI Use
Claude Code did the typing here, I did the asking. Description too. I will review and test.