Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation ai buttons next to seo keyphrase assessments #21348

Conversation

FAMarfuaty
Copy link
Contributor

@FAMarfuaty FAMarfuaty commented Apr 29, 2024

Context

  • For the following assessments, we need to add an AI button next to the assessments:
    • Keyphrase in introduction
    • Keyphrase subheadings
    • Keyphrase density
    • Keyphrase distribution
  • This PR implements the AI button for the assessments above

Summary

This PR can be summarized in the following changelog entry:

  • Adds AI assessment fixes buttons next to the assessment feedback of the keyphrase in introduction, keyphrase in subheading, and keyphrase density assessments.
  • [@yoast/analysis-report] Makes it possible to render the AI Assessment Fixes button inside AnalysisResult.js.
  • [yoastseo] Adds new property hasAIFixes in AssessmentResult class.
  • [yoastseo] Adds a logic to set hasAIFixes to true for a certain condition for keyphrase in introduction, keyphrase in subheading, keyphrase density, and keyphrase distribution assessment's result.
  • [@yoast/components] Adds components for the AI Assessment Fixes button.
  • [wordpress-seo-premium] Adds AI assessment fixes button next to the assessment feedback of keyphrase in introduction, keyphrase in subheading, keyphrase density, and keyphrase distribution assessment.
  • [shopify-seo] Adds a wider gap between assessment result list items.

Relevant technical choices:

  • We're aware that we're making changes and using components from @yoast/components package. This is because even though technically we can use @yoast/ui-library package for this purpose, the stylings of the new AI button will not be consistent with the highlighting and the edit button. For the sake of consistency and UI cohesiveness, we are using the same stylings/components that we're using for the highlighting and the edit button. Eventually, in the new Tailwind style, we need to replace all the buttons and tooltips at once.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

WordPress

Shopify

  • Test in Shopify product
  • Create a product and add some content
  • Go to SEO analysis tab
  • Confirm that now between assessment result list items, there is a 12px gap
  • Confirm that this is also the case for Readability analysis and Inclusive language analysis
  • Additionally, make sure that there is no error in the console

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:

  • The changes introduced in this PR may have an impact on how the eye icon/highlighting button is displayed. So when testing, please also pay attention to how the eye icon is displayed. They should not change.
  • We also made some changes in analysis-report package which is also being used in Shopify. Please smoke test in shopify and confirm that we didn't change the behaviour/display of the eye icon.

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

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.

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.

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 https://github.com/Yoast/wordpress-seo-premium/issues/4285

@FAMarfuaty FAMarfuaty changed the base branch from trunk to feature/fix-assessments April 30, 2024 07:41
Copy link

github-actions bot commented Apr 30, 2024

@FAMarfuaty Please be aware that following packages have been abandoned and are not actively maintained anymore:

Package name Path
@yoast/babel-preset packages/babel-preset
@yoast/components packages/components
@yoast/e2e-tests packages/e2e-tests
@yoast/helpers packages/helpers
@yoast/jest-preset packages/jest-preset
@yoast/style-guide packages/style-guide

Please consider using the other packages instead.

@FAMarfuaty FAMarfuaty added changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog UI change PRs that result in a change in the UI labels May 2, 2024
…that `AnalysisResult` component knows less about the specific details of AI Button
…ents' of github.com:Yoast/wordpress-seo into implementation-ai-buttons-next-to-seo-keyphrase-assessments
…ep track whether the button is pressed or not. This enables synchronizing pressed button styles between the AI button in the sidebar and in the metabox.
@mhkuu mhkuu added this to the feature/fix-assessments milestone May 10, 2024
Copy link
Contributor

@mhkuu mhkuu left a comment

Choose a reason for hiding this comment

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

CR: Really well done! 👍 I've added a few small comments to potentially address. Feel free to ignore some of these.

ACC: I've added one question to the ATP that we need to discuss. I've taken it for a quick spin. It seems like everything is in order, just two comments:

  • It should not be possible to have the AI button active as well as a highlight button. It would be great if they would cancel each other out.
  • When clicking the eye button, the AI button moves up just a bit (1px?), and sometimes the assessment text moves up just a bit as well.

packages/analysis-report/src/AnalysisResult.js Outdated Show resolved Hide resolved
packages/analysis-report/src/AnalysisResult.js Outdated Show resolved Hide resolved
packages/analysis-report/src/AnalysisResult.js Outdated Show resolved Hide resolved
packages/analysis-report/src/ContentAnalysis.js Outdated Show resolved Hide resolved
packages/components/src/IconAIFixesButton.js Outdated Show resolved Hide resolved
packages/js/src/redux/reducers/activeAIButton.js Outdated Show resolved Hide resolved
packages/js/src/components/contentAnalysis/SeoAnalysis.js Outdated Show resolved Hide resolved
@Jordi-PV Jordi-PV assigned Jordi-PV and unassigned Jordi-PV May 10, 2024
@FAMarfuaty FAMarfuaty added the Shopify This PR impacts Shopify. label May 13, 2024
Copy link
Contributor

@mhkuu mhkuu left a comment

Choose a reason for hiding this comment

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

CR: Looks great! 😸

@FAMarfuaty
Copy link
Contributor Author

@mhkuu I pushed a commit to fix tiny typos in JSDoc 😸

const isPremium = getL10nObject().isPremium;

// The reason of adding the check if Elementor is active or not is because `isBlockEditor` method also returns `true` for Elementor.
return hasAIFixes && isBlockEditor() && ! this.props.isElementor && (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This helper to check if Block editor is active isBlockEditor helper packages/js/src/helpers/isBlockEditor.js is not quite accurate: it also returns true inside Elementor. We got the value from WP_Screen::get()->is_block_editor();. As a workaround to make sure that the AI button is not shown in Elementor, here I added an extra check that the editor is NOT Elementor. So far I haven't found a more reliable method to check for Block editor. If such method exist, I guess that method would be preferable here

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, it's not optimal -- I guess we could also consider removing

'isBlockEditor' => WP_Screen::get()->is_block_editor(),

But I'm OK with the current implementation as well.

@mhkuu
Copy link
Contributor

mhkuu commented May 15, 2024

ACC: Everything works as advertised, there is just a small problem with the Elementor in-between-screen, but as the behaviour of the metabox/sidebar there is erratic anyway, we can have a look at that later.

Nice work! 🚀

@mhkuu mhkuu merged commit 2ff3eaf into feature/fix-assessments May 15, 2024
17 checks passed
@mhkuu mhkuu deleted the implementation-ai-buttons-next-to-seo-keyphrase-assessments branch May 15, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog Shopify This PR impacts Shopify. UI change PRs that result in a change in the UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants