Add SEO, social & slug commands to the command palette#23087
Draft
enricobattocchi wants to merge 3 commits into
Draft
Add SEO, social & slug commands to the command palette#23087enricobattocchi wants to merge 3 commits into
enricobattocchi wants to merge 3 commits into
Conversation
Add 4 new commands alongside the existing focus keyphrase command: edit SEO title, edit meta description, edit social title, and edit social description. Each opens the Yoast sidebar, dispatches the appropriate modal (search appearance or social appearance), and focuses the target input field with retry. The hook now accepts feature toggles (isKeywordAnalysisActive, useOpenGraphData) to conditionally enable/disable commands, removing the need for external conditional rendering. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Register a "Yoast SEO: Edit slug" command that opens the Search Appearance modal and focuses the slug input field. This command is always enabled, independent of feature toggles. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pull Request Test Coverage Report for Build 753e443198aa0776d17f5b8419f88180663c8694Details
💛 - Coveralls |
Contributor
There was a problem hiding this comment.
Pull request overview
Extends the Yoast SEO integration with the WordPress command palette by registering commands that open the Yoast sidebar/modals and focus key SEO/social inputs for quicker editing in the block editor.
Changes:
- Added a new
useCommandPaletteCommandshook to register 6 command palette commands (keyphrase, SEO title/description, slug, social title/description). - Wired the new hook into the block editor integration so commands are registered during editor initialization.
- Added unit tests for command registration, callbacks, and enabled/disabled behavior; updated JS dependencies/lockfile to include
@wordpress/commands.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Pulls in dependency graph updates related to @wordpress/commands and its transitive deps. |
| packages/js/package.json | Adds @wordpress/commands dependency needed for the command palette integration. |
| packages/js/src/initializers/block-editor-integration.js | Registers the command palette commands in the block editor integration render tree. |
| packages/js/src/hooks/use-command-palette-commands.js | Implements command registration + callback behavior (open sidebar/modals + focus fields with retry). |
| packages/js/tests/hooks/use-command-palette-commands.test.js | Adds unit coverage for registration, callbacks, and enabled gating rules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The hook only runs in the block editor where core/edit-post is always registered. Use consistent destructuring instead of optional chaining to avoid a false sense of safety while still calling unconditionally. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch. |
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.
Context
Extends the existing "Set focus keyphrase" command palette integration with 5 additional commands, giving editors quick access to key Yoast SEO fields directly from the WordPress command palette (Cmd+K / Ctrl+K).
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
use-set-focus-keyphrase-commandhook touse-command-palette-commandsto hold all 6 commands in a single hook.openEditorModalto open the appropriate modal (Search Appearance or Social Appearance), and focuses the target input with a retry mechanism.useCommand'senabledoption based onisKeywordAnalysisActive(keyphrase, SEO title, SEO description) anduseOpenGraphData(social title, social description). The slug command is always enabled.isKeywordAnalysisActiveconditional wrapper around<CommandPaletteCommands />in the integration file — the hook now handles conditional registration internally, since social and slug commands don't depend on keyword analysis.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
Relevant test scenarios
The command palette is only available in the block editor. Test on different post types to ensure the sidebar and modals open correctly in each context. Check the console for any errors during command execution.
Test instructions for QA when the code is in the RC
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
Other environments
Documentation
Quality assurance
grunt build:imagesand commited the results, if my PR introduces new images or SVGs.Innovation
innovationlabel.