wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

Add schema feature toggle and settings page

Open leonidasmi opened this issue 1 month ago • 1 comments

Context

Summary

This PR can be summarized in the following changelog entry:

  • Adds a way to easily disable the Yoast schema.

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:

  • For the confirmation modal layout refer to this thread

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
  • [x] 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.

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 ran 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 #

leonidasmi avatar Dec 01 '25 12:12 leonidasmi

Pull Request Test Coverage Report for Build b297a102e39b2007cbf436fb16441d0beb8d529d

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 19 of 181 (10.5%) changed or added relevant lines in 17 files are covered.
  • 82 unchanged lines in 17 files lost coverage.
  • Overall coverage decreased (-11.1%) to 41.433%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/integrations/settings-integration.php 1 2 50.0%
packages/js/src/integrations-page/woocommerce-integration.js 0 2 0.0%
packages/js/src/integrations-page/integrations-grid.js 0 3 0.0%
packages/js/src/integrations-page/plugin-integration.js 0 3 0.0%
packages/js/src/settings/components/schema-disable-confirmation-modal.js 0 3 0.0%
src/conditionals/schema-disabled-conditional.php 0 4 0.0%
src/schema/infrastructure/disable-schema-integration.php 0 5 0.0%
packages/js/src/settings/components/schema-programmatically-disabled-modal.js 0 6 0.0%
packages/js/src/settings/hooks/use-schema-toggle-handler.js 1 7 14.29%
packages/js/src/settings/store/schema-framework.js 0 8 0.0%
<!-- Total: 19 181
Files with Coverage Reduction New Missed Lines %
src/integrations/settings-integration.php 1 26.95%
src/dashboard/user-interface/time-based-seo-metrics/time-based-seo-metrics-route.php 1 94.02%
src/dashboard/user-interface/configuration/site-kit-consent-management-route.php 1 85.37%
src/integrations/admin/integrations-page.php 1 79.44%
packages/js/src/integrations-page/woocommerce-integration.js 1 0.0%
src/presenters/debug/marker-open-presenter.php 1 94.74%
src/dashboard/user-interface/configuration/site-kit-capabilities-integration.php 1 93.33%
packages/js/src/integrations-page/integrations-grid.js 1 0.0%
packages/js/src/settings/routes/site-features.js 1 0.0%
packages/js/src/integrations-page/plugin-integration.js 1 0.0%
<!-- Total: 82
Totals Coverage Status
Change from base Build bf24bec1e45770deae5b68bf87e981a3db8b213c: -11.1%
Covered Lines: 22742
Relevant Lines: 51465

💛 - Coveralls

coveralls avatar Dec 01 '25 13:12 coveralls

One thing I noticed, when schema is disabled via the filter:

We then show in the integration page a message about the schema being disabled (rightly so), but then instruct the user to enable it in the settings, which is not right since they will not be able to enable it from there, until they remove the filter.

So, to recap. When we have disabled schema via filter, we show this in the integrations page: image but we should show something similar to what we show in the schema page: image

leonidasmi avatar Dec 12 '25 07:12 leonidasmi

Also, I'm not able to tell by the design, but when we have disabled schema via the filter, it looks like the main feature toggle is disabled in the schema page, but in the PR it's not: image

I've noticed that instead it has the same behavior with the main feature card (that is, it's not disabled but displays a warning modal when tried to be toggled on), so if we have double checked that it's ok with Tom, then all goo

leonidasmi avatar Dec 12 '25 08:12 leonidasmi

One thing I noticed, when schema is disabled via the filter:

We then show in the integration page a message about the schema being disabled (rightly so), but then instruct the user to enable it in the settings, which is not right since they will not be able to enable it from there, until they remove the filter.

So, to recap. When we have disabled schema via filter, we show this in the integrations page: image but we should show something similar to what we show in the schema page: image

Good appreciation 👍🏼 I'll double check it with @ux-tom

Update:

  • I've confirmed with @ux-tom that this is correct, it should still re-direct to the Schema Framework page.

JorPV avatar Dec 12 '25 10:12 JorPV

Also, I'm not able to tell by the design, but when we have disabled schema via the filter, it looks like the main feature toggle is disabled in the schema page, but in the PR it's not: image

I've noticed that instead it has the same behavior with the main feature card (that is, it's not disabled but displays a warning modal when tried to be toggled on), so if we have double checked that it's ok with Tom, then all goo

I know what you mean, but in the design the toogle has always an slate-200 value when disabled, it doesn't matter if the filter is present or not.

Regarding your point of only showing the info modal in the Site Features toggle, and not in the Schema page toggle, I'm not sure whether it makes sense 🤔 So good that you notice it! I'll check it with @ux-tom as well!

Update:

  • Here too, I've confirmed with Tom that the toogle is just switched off, no disabled, and it should show the modal on click.

JorPV avatar Dec 12 '25 11:12 JorPV

CR: ✅, aside from one thing I missed and want us to improve:

* In `Schema_Disabled_Conditional`, turn `return ! $this->options->get( 'enable_schema', true );` into `return $this->options->get( 'enable_schema', true ) === false;`, to check for false specifically instead of just false-y values

* I did that and performed some regression test and looks good, but before pushing that change, I wouldnt mind a second look from you too @JorPV

You are right, $this->options->get( 'enable_schema', true ) === false is safer since the option should only be considered disabled when it's explicitly falsy.

JorPV avatar Dec 17 '25 13:12 JorPV