Skip to content

Disable 'Correct spelling and grammar' toolbar option by default#47916

Open
saroshaga wants to merge 3 commits intotrunkfrom
update/disable-correct-spelling-option
Open

Disable 'Correct spelling and grammar' toolbar option by default#47916
saroshaga wants to merge 3 commits intotrunkfrom
update/disable-correct-spelling-option

Conversation

@saroshaga
Copy link
Copy Markdown
Contributor

@saroshaga saroshaga commented Apr 3, 2026

Summary

  • Disables the "Correct spelling and grammar" option from AI Assistant toolbar menus by default
  • Gates the feature behind a new ai_correct_spelling_enabled PHP filter (default false), following the same pattern used by other AI features like breve_enabled and ai_seo_enhancer_enabled
  • The option is hidden in both the AI Assistant block toolbar dropdown and the "Write with AI" prompt templates control

More Context

  • pgLAn3-iK-p2
  • p1HpG7-xUC-p2

Changes

  • ai-assistant.php: Added new ai_correct_spelling_enabled filter (default false) that controls ai-correct-spelling extension availability
  • extensions/index.json: Registered ai-correct-spelling as a production extension
  • dropdown-content.tsx: Added feature availability check to filter out "Correct spelling and grammar" from quick actions when disabled
  • prompt-templates-control/index.tsx: Added feature availability check to conditionally render the "Correct spelling and grammar" menu item

Re-enabling

To re-enable the feature, add this filter:

```php
add_filter( 'ai_correct_spelling_enabled', '__return_true' );
```

Testing instructions:

  1. Build the Jetpack plugin (`pnpm jetpack build plugins/jetpack`)
  2. Open the WordPress block editor and create/edit a post
  3. Type some text in a paragraph block, then select it
  4. Click the AI Assistant toolbar button (sparkle icon) on the block toolbar
  5. Verify the "Correct spelling and grammar" option is not shown in the dropdown menu
  6. Click the "Write with AI…" button in the AI Assistant block toolbar
  7. Verify the "Correct spelling and grammar" option is not shown under "Based on preceding content…"
  8. Verify all other AI options (Simplify, Summarize, Make longer, etc.) still appear and work
  9. Add `add_filter( 'ai_correct_spelling_enabled', '__return_true' );` to your theme's `functions.php`
  10. Reload the editor and verify the "Correct spelling and grammar" option reappears in both menus

Does this pull request change what data or activity we track or use?

No. This PR only changes the default visibility of an existing UI option. No new data collection, tracking, or privacy-related changes are introduced.

🤖 Generated with Claude Code

Gate the "Correct spelling and grammar" quick edit behind a new
ai_correct_spelling_enabled filter (default false). This hides the
option from both the AI Assistant toolbar dropdown and the prompt
templates control menu. Re-enable per-site with:
add_filter( 'ai_correct_spelling_enabled', '__return_true' );

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@saroshaga saroshaga requested review from Copilot and dhasilva April 3, 2026 09:38
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the update/disable-correct-spelling-option branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/disable-correct-spelling-option

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Block] AI Assistant [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Apr 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Apr 3, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR disables the “Correct spelling and grammar” option in Jetpack’s AI Assistant UI by default, while allowing it to be re-enabled via a new PHP filter controlling the ai-correct-spelling extension availability.

Changes:

  • Gate ai-correct-spelling extension availability behind a new ai_correct_spelling_enabled filter (default false).
  • Hide the “Correct spelling and grammar” entry from both the AI Assistant toolbar dropdown quick actions and the “Write with AI” prompt templates menu when unavailable.
  • Register ai-correct-spelling in the Jetpack extensions production list and add a changelog fragment.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
projects/plugins/jetpack/extensions/index.json Adds ai-correct-spelling to the production extensions list.
projects/plugins/jetpack/extensions/blocks/ai-assistant/components/prompt-templates-control/index.tsx Conditionally renders the “Correct spelling and grammar” menu item based on feature availability.
projects/plugins/jetpack/extensions/blocks/ai-assistant/components/ai-assistant-toolbar-dropdown/dropdown-content.tsx Filters out the “Correct spelling and grammar” quick action when the feature is unavailable.
projects/plugins/jetpack/extensions/blocks/ai-assistant/ai-assistant.php Introduces the ai_correct_spelling_enabled filter and gates extension registration.
projects/plugins/jetpack/changelog/disable-correct-spelling-option Documents the default-disable behavior via a changelog fragment.

Comment on lines 20 to 25
/**
* Internal dependencies
*/
import { getFeatureAvailability } from '../../lib/utils/get-feature-availability';
import { __ } from '@wordpress/i18n';
import { title, postContent, postExcerpt, termDescription, post, pencil } from '@wordpress/icons';
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new internal import is splitting the “External dependencies” import group: @wordpress/i18n and @wordpress/icons are external but now appear after the internal-deps block. Please reorder so all external imports remain together, then the internal-dependencies section (and keep the section comment style consistent).

Suggested change
/**
* Internal dependencies
*/
import { getFeatureAvailability } from '../../lib/utils/get-feature-availability';
import { __ } from '@wordpress/i18n';
import { title, postContent, postExcerpt, termDescription, post, pencil } from '@wordpress/icons';
import { __ } from '@wordpress/i18n';
import { title, postContent, postExcerpt, termDescription, post, pencil } from '@wordpress/icons';
/*
* Internal dependencies
*/
import { getFeatureAvailability } from '../../lib/utils/get-feature-availability';

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +5
Comment: Disable the 'Correct spelling and grammar' option from AI Assistant toolbar menus by default. It can be re-enabled via the 'ai_correct_spelling_enabled' filter.

AI Assistant: Disable the "Correct spelling and grammar" toolbar option by default.
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changelog fragment includes a Comment: header even though an entry text is present below. In the Jetpack changelog fragments, Comment: is typically used only when there is no entry text (e.g., carousel-remove-medium, update-newsletter-panel-title-no-i18n). Consider removing the Comment: header and incorporating any needed context into the entry text instead.

Suggested change
Comment: Disable the 'Correct spelling and grammar' option from AI Assistant toolbar menus by default. It can be re-enabled via the 'ai_correct_spelling_enabled' filter.
AI Assistant: Disable the "Correct spelling and grammar" toolbar option by default.
AI Assistant: Disable the "Correct spelling and grammar" toolbar option by default. It can be re-enabled via the `ai_correct_spelling_enabled` filter.

Copilot uses AI. Check for mistakes.
@jp-launch-control
Copy link
Copy Markdown

jp-launch-control bot commented Apr 3, 2026

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/extensions/blocks/ai-assistant/ai-assistant.php 0/57 (0.00%) 0.00% 2 ❤️‍🩹
projects/plugins/jetpack/extensions/blocks/ai-assistant/components/ai-assistant-toolbar-dropdown/dropdown-content.tsx 0/19 (0.00%) 0.00% 1 ❤️‍🩹
projects/plugins/jetpack/extensions/blocks/ai-assistant/components/prompt-templates-control/index.tsx 0/23 (0.00%) 0.00% 1 ❤️‍🩹

Full summary · PHP report · JS report

saroshaga and others added 2 commits April 3, 2026 15:19
Address Copilot review feedback and CI failures:
- Fix import order: move internal import after all external @WordPress imports
- Fix prettier formatting of multi-line filter condition
- Remove invalid Comment: header from changelog and use 'other' type
- Incorporate filter details into changelog entry text

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Correct tab indentation on the parenthesized filter condition
to match prettier's expected output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@saroshaga
Copy link
Copy Markdown
Contributor Author

@claude please review

@saroshaga saroshaga requested a review from Copilot April 3, 2026 10:17
@claude
Copy link
Copy Markdown
Contributor

claude bot commented Apr 3, 2026

Claude finished @saroshaga's task in 1m 36s —— View job


PR Review

  • Gathering context and reading changed files
  • Reviewing PHP changes
  • Reviewing TypeScript changes
  • Reviewing changelog and index.json
  • Posting final review

Overall this is a clean, well-scoped PR that correctly follows the established pattern for gating AI features behind PHP filters. Here are my observations:

PHP — ai-assistant.php

The implementation at lines 87–89 is correct and consistent with the breve_enabled and ai_seo_enhancer_enabled patterns:

if ( apply_filters( 'ai_correct_spelling_enabled', false ) ) {
    Jetpack_Gutenberg::set_extension_available( 'ai-correct-spelling' );
}

The filter is correctly nested inside the jetpack_ai_enabled check, so spelling correction only registers if the broader AI feature is active. No issues here.

TypeScript — dropdown-content.tsx

The feature gating works, but there's a minor style issue: there's no blank line before the /** Internal dependencies */ JSDoc comment at line 27, which is inconsistent with standard Jetpack code style. The same issue exists in prompt-templates-control/index.tsx (line 22). These are cosmetic but ESLint/Prettier may enforce them.

The filter logic at lines 240–245 is functional but could be slightly easier to read. It currently chains two negated conditions:

.filter(
    quickAction =>
        !( quickAction.options?.rootParentOnly && blockParents.length > 0 ) &&
        !(
            quickAction.key === QUICK_EDIT_KEY_CORRECT_SPELLING && !isCorrectSpellingAvailable
        )
)

This is correct — no bug here — just worth noting for readability.

TypeScript — prompt-templates-control/index.tsx

The conditional rendering at lines 160–168 is clean and straightforward. The isCorrectSpellingAvailable check is called at the top of the component (line 111), consistent with how it's done in dropdown-content.tsx.

Import ordering note: Copilot flagged the import order, but looking at the current file the @wordpress/i18n and @wordpress/icons imports (lines 20–21) are correctly placed in the external dependencies section, above the /* Internal dependencies */ comment (line 22–25). This appears to already be resolved in the latest fix commit.

Changelog

The changelog fragment correctly has no Comment: header and directly contains the entry text — Copilot's suggestion on this is already addressed.

extensions/index.json

Adding ai-correct-spelling to the production list is required for getFeatureAvailability('ai-correct-spelling') to function correctly in JS. Good.

Missing items (per the bot comment)

The GitHub Actions bot flagged two required sections missing from the PR description:

  • Testing instructions — the PR has a test plan checklist, but the bot wants it under a ## Testing instructions: header
  • Data/privacy statement — needs ## Does this pull request change what data or activity we track or use?

These are required by the PR template and should be added to the description. Fix this →

Summary

The code changes are correct, well-structured, and follow existing patterns. The main action items are:

  1. Add the ## Testing instructions: and ## Does this pull request change what data or activity we track or use? sections to the PR description to satisfy the PR template checks
  2. The blank-line-before-comment style issue in both TSX files is minor but worth fixing if ESLint enforces it
    | Branch: update/disable-correct-spelling-option

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@saroshaga saroshaga added the [Status] Needs Review This PR is ready for review. label Apr 3, 2026
Copy link
Copy Markdown
Contributor

@CGastrell CGastrell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] AI Assistant [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Status] Needs Review This PR is ready for review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants