Skip to content

Keep the focus keyphrase read-only when the SEO analysis is off - #23593

Open
JorPV wants to merge 5 commits into
trunkfrom
bulk-editor/seo-analysis-disabled
Open

Keep the focus keyphrase read-only when the SEO analysis is off#23593
JorPV wants to merge 5 commits into
trunkfrom
bulk-editor/seo-analysis-disabled

Conversation

@JorPV

@JorPV JorPV commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Context

When the SEO analysis site feature is disabled, the post editor hides the focus keyphrase input entirely. The bulk editor did not follow the same behaviour: the keyphrase column was still fully editable, so users could set a keyphrase that nothing would ever assess.

Per the discussion on the issue, the bulk editor deliberately diverges from the post editor here — the column stays visible, because the stored keyphrase is still useful context when scanning rows, but it is no longer editable.

The companion Premium PR blocks bulk AI generation in the same situation.

Summary

  • Fixes a bug where the focus keyphrase could be edited in the bulk editor when the SEO analysis was disabled.

Relevant technical choices

  • Read-only fields never enter the row draft. Every save path iterates the row's open fields, so keeping the keyphrase out of the draft also guarantees focus_keyphrase can never reach an update payload and blank a stored keyphrase.
  • New analysis store slice rather than a new preferences entry. The flag is already localized under wpseoBulkEditorData.analysis; duplicating it into preferences would give the page two sources of truth for one option.

Test instructions for the acceptance test before the PR gets merged

Note

Test together with the Premium PR for the AI generation half of this fix.

  1. Go to Yoast SEO > Settings > Site features, and turn SEO analysis off and click Save changes.
  2. Go to Yoast SEO > Tools > Bulk editor and confirm the Focus keyphrase column is still present and still shows each post's keyphrase.
  3. Click Edit on a row and confirm the SEO title and Meta description become editable while the keyphrase stays plain text with no text area to edit it.
  4. Switch to the Social appearance tab and repeat step 3; confirm the keyphrase is read-only there too.
  5. With a row still in edit mode, open the browser Network tab, change the SEO title and click Save; confirm the update_search request body contains seo_title but no focus_keyphrase.
  6. Reload the page and confirm that row's keyphrase is unchanged.
  7. Turn SEO analysis back on, reload the bulk editor, and confirm Edit opens all three fields again and the save request carries focus_keyphrase.
  8. Run yarn workspace @yoast/wordpress-seo jest tests/bulk-editor and expect 38 suites / 387 tests passing.

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

The bulk editor has a content-type sub-navigation, so check at least Posts and Pages.

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

Impact check

  • Tools → Bulk editor: the Focus keyphrase column and inline row editing.
  • The bulk editor's Redux store (new analysis slice).

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.

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 Yoast/plugins-automated-testing#3138

JorPV and others added 3 commits September 4, 2026 15:46
…lysis is off

The bulk editor let users edit the focus keyphrase even with the SEO analysis
site feature disabled, unlike the post editor which hides the field entirely.
The column stays visible here on purpose — the keyphrase is still useful
context — but it no longer opens for editing.

Read-only fields are kept out of the row draft, so they never become open
fields. Since every save path iterates the open fields, `focus_keyphrase` can
no longer reach an update payload and blank an existing keyphrase.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@JorPV JorPV added changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog innovation Innovative issue. Relating to performance, memory or data-flow. labels Sep 4, 2026
@coveralls-official

coveralls-official Bot commented Sep 4, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 7

Coverage at 41.03% (no base build to compare)

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 1 uncovered change across 1 file (22 of 23 lines covered, 95.65%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
packages/js/src/bulk-editor/hooks/use-inline-edit.js 14 13 92.86%
Total (4 files) 23 22 95.65%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 19769
Covered Lines: 8547
Line Coverage: 43.23%
Relevant Branches: 12688
Covered Branches: 4770
Branch Coverage: 37.59%
Branches in Coverage %: Yes
Coverage Strength: 19.93 hits per line

💛 - Coveralls

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A confirmed edge-case bug in onApplyRow can leave skipped/read-only open fields stuck in a perpetual “saving” state because setSavingField is still applied to all openFields.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR aligns the bulk editor with the “SEO analysis off” behavior by keeping the Focus keyphrase column visible for context while preventing edits, and by wiring a localized “analysis active” flag into the bulk editor’s Redux store so UI/editing behavior is consistent across tabs.

Changes:

  • Added a new analysis store slice that reads wpseoBulkEditorData.analysis.keywordAnalysisActive and exposes a selector for “SEO analysis active”.
  • Made the Focus keyphrase field read-only when SEO analysis is disabled, and ensured inline-edit save paths exclude read-only fields from drafts and request payloads.
  • Added/updated Jest coverage for the new slice and the read-only keyphrase behavior in the table and inline-edit hook.
File summaries
File Description
packages/js/tests/bulk-editor/store/analysis.test.js New tests for initializing/selecting the SEO analysis active flag.
packages/js/tests/bulk-editor/hooks/use-inline-edit.test.js New coverage to ensure read-only fields don’t enter drafts or request payloads.
packages/js/tests/bulk-editor/field-sets.test.js Updates field set expectations and adds a read-only scenario test.
packages/js/tests/bulk-editor/bulk-editor-table.test.js Verifies the keyphrase column stays visible but does not render an input when analysis is off.
packages/js/tests/bulk-editor/app.test.js Seeds localized analysis state before store registration for consistent test behavior.
packages/js/src/bulk-editor/store/index.js Registers the new analysis slice (actions/selectors/initial state/reducer).
packages/js/src/bulk-editor/store/analysis.js New Redux slice + selector for the localized analysis active flag.
packages/js/src/bulk-editor/hooks/use-inline-edit.js Excludes read-only fields from drafts and blocks read-only fields from save payloads.
packages/js/src/bulk-editor/field-sets.js Adds readOnly support and marks Focus keyphrase read-only when analysis is off.
packages/js/src/bulk-editor/components/bulk-editor-content.js Builds field sets based on the store’s “analysis active” flag so tabs reflect read-only behavior.
Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/js/src/bulk-editor/hooks/use-inline-edit.js
onApplyRow marked every open field as saving, but only the fields that made it
into a request were ever closed or unset. A read-only field that reached the
open fields would sit in a permanent saving state and hold the row in edit
mode.

Only the fields actually going out are marked saving now, and a field that can
never be saved is closed instead. A missing endpoint is deliberately not
treated that way: that field stays open so it can be retried once the endpoint
exists.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@JorPV
JorPV marked this pull request as ready for review September 4, 2026 14:37
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 innovation Innovative issue. Relating to performance, memory or data-flow.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants