Skip to content

Implement AIOptimizeButton state management#22908

Merged
vraja-pro merged 1 commit intotrunkfrom
jordi-pv/ai-optimize-buttons-are-not-disabled
Jan 27, 2026
Merged

Implement AIOptimizeButton state management#22908
vraja-pro merged 1 commit intotrunkfrom
jordi-pv/ai-optimize-buttons-are-not-disabled

Conversation

@JorPV
Copy link
Copy Markdown
Contributor

@JorPV JorPV commented Jan 23, 2026

Context

  • Fixes a bug where the Yoast AI Optimize buttons remained active after another button in the group had already been pressed.

Summary

This PR can be summarized in the following changelog entry:

  • Fixes a bug where the AI Optimize buttons remained active even when another button had been pressed.

Relevant technical choices:

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

In an environment with access to the Yoast AI features.

  • Create a post in Block editor/Classic editor.
  • Set your focus keyphrase.
  • In your post, add some blocks from the following types: Paragraph, Heading, List, Details, and Table block.
  • Add text of less than 1000 words/2000 tokens.
  • Make sure to NOT add the keyphrase to the text.
  • Go to the SEO analysis in the metabox/sidebar.
  • You should see that the AI button for Keyphrase in introduction, density and keyphrase distribution are enabled.
  • Click on the AI button for one of the Keyphrase assessments.
  • When the AI Optimize dialog and the AI suggestions are en preview mode, check the status of the other AI Optimize buttons for the other assessments.
  • Confirm that they are disabled.
  • Hover over them and confirm that they show a tooltip with the label 'Please apply or discard the current AI suggestion.'
image
  • Confirm that clicking on them doesn't change the toast title or triggers any errors in the console.
  • Dismiss the AI notification and confirm that they are again enabled with tooltip 'Optimize with AI' on hover.
  • Smoke test the same behavior for the AI Optimize buttons in the Readability analysis (also if the button pressed is a button for the SEO assessments, the AI buttons for the Readability assessments should be disabled and, vice versa).

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.
  • This PR also affects Yoast SEO for Google Docs. I have added a changelog entry starting with [yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached the Google Docs Add-on label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.
  • I have run grunt build:images and commited the results, if my PR introduces new images or SVGs.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #4847

@JorPV JorPV added the changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog label Jan 23, 2026
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 3b66456fbb75a986ee245c0af7b625d5b9f337d3

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 53.355%

Totals Coverage Status
Change from base Build ff2f33de1ce7594487c7285b42c46e5570ceee1c: 0.005%
Covered Lines: 32900
Relevant Lines: 61870

💛 - Coveralls

@JorPV JorPV marked this pull request as ready for review January 23, 2026 15:42
Copy link
Copy Markdown
Contributor

@vraja-pro vraja-pro left a comment

Choose a reason for hiding this comment

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

CR & AC ✅

@vraja-pro vraja-pro added this to the 27.0 milestone Jan 27, 2026
@vraja-pro vraja-pro merged commit df0e03d into trunk Jan 27, 2026
23 checks passed
@vraja-pro vraja-pro deleted the jordi-pv/ai-optimize-buttons-are-not-disabled branch January 27, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants